Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws4-axios

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws4-axios - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

dist/index.test.d.ts

15

dist/index.d.ts

@@ -7,3 +7,18 @@ import { AxiosRequestConfig } from "axios";

}
/**
* Create an interceptor to add to the Axios request chain. This interceptor
* will sign requests with the AWSv4 signature.
*
* @example
* axios.interceptors.request.use(
* aws4Interceptor({ region: "eu-west-2", service: "execute-api" })
* );
*
* @param options The options to be used when signing a request
*/
export declare const aws4Interceptor: (options?: InterceptorOptions | undefined) => (config: AxiosRequestConfig) => AxiosRequestConfig;
/**
* @deprecated Please use the alternative export of `aws4Interceptor`
*/
export declare const interceptor: (options?: InterceptorOptions | undefined) => (config: AxiosRequestConfig) => AxiosRequestConfig;
export {};

17

dist/index.js

@@ -5,3 +5,14 @@ "use strict";

var url_1 = require("url");
exports.interceptor = function (options) { return function (config) {
/**
* Create an interceptor to add to the Axios request chain. This interceptor
* will sign requests with the AWSv4 signature.
*
* @example
* axios.interceptors.request.use(
* aws4Interceptor({ region: "eu-west-2", service: "execute-api" })
* );
*
* @param options The options to be used when signing a request
*/
exports.aws4Interceptor = function (options) { return function (config) {
if (!config.url) {

@@ -29,1 +40,5 @@ throw new Error("No URL present in request config, unable to sign request");

}; };
/**
* @deprecated Please use the alternative export of `aws4Interceptor`
*/
exports.interceptor = exports.aws4Interceptor;

9

package.json
{
"name": "aws4-axios",
"version": "1.3.0",
"version": "1.4.0",
"description": "Axios request interceptor for signing requests with AWSv4",

@@ -25,6 +25,11 @@ "author": "James Bourne",

"scripts": {
"prepare": "tsc"
"prepare": "tsc",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"eslint": "^5.16.0",
"jest": "^24.8.0",
"ts-jest": "^24.0.2",
"typescript": "^3.5.1"

@@ -31,0 +36,0 @@ },

@@ -9,1 +9,49 @@ # aws4-axios

This may be useful for accessing AWS services protected with IAM auth such as an API Gateway.
# Installation
| yarn | npm |
| --------------------- | ------------------------------- |
| `yarn add aws4-axios` | `npm install --save aws4-axios` |
# Usage
To add an interceptor to the default Axios client:
```typescript
import axios from "axios";
import { aws4Interceptor } from "aws4-axios";
const interceptor = aws4Interceptor({
region: "eu-west-2",
service: "execute-api"
});
axios.interceptors.request.use(interceptor);
// Requests made using Axios will now be signed
axios.get("https://example.com/foo").then(res => {
// ...
});
```
Or you can add the interceptor to a specific instance of an Axios client:
```typescript
import axios from "axios";
import { aws4Interceptor } from "aws4-axios";
const client = axios.create();
const interceptor = aws4Interceptor({
region: "eu-west-2",
service: "execute-api"
});
client.interceptors.request.use(interceptor);
// Requests made using Axios will now be signed
client.get("https://example.com/foo").then(res => {
// ...
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc