Skip to content

Commit

Permalink
Merge pull request #40 from manueliglesias/fix/user-agent
Browse files Browse the repository at this point in the history
Update x-amz-user-agent header
  • Loading branch information
mlabieniec authored Feb 9, 2018
2 parents 5c06f2b + 50d0dac commit fb9dea9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/aws-appsync/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### vNext
- Update x-amz-user-agent header [PR#40](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/40)

### 1.0.9
- Fix AWS_IAM credentials fetching [PR#38](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/38)
- Preserve the observer associated with an existing topic [PR#37](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/37)
Expand Down
6 changes: 4 additions & 2 deletions packages/aws-appsync/src/link/auth-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import { print } from 'graphql/language/printer';
import aws4 from './signer/signer';
import * as Url from 'url';

var packageInfo = require("../../package.json");
import { userAgent } from "../platform";

const packageInfo = require("../../package.json");

const SERVICE = 'appsync';
const USER_AGENT_HEADER = 'x-amz-user-agent';
const USER_AGENT = `aws-appsync-sdk-js/${packageInfo.version}`;
const USER_AGENT = `aws-amplify/${packageInfo.version}${userAgent && ' '}${userAgent}`;

export const AUTH_TYPE = {
NONE: 'NONE',
Expand Down
3 changes: 3 additions & 0 deletions packages/aws-appsync/src/platform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const userAgent = '';

export { userAgent };
3 changes: 3 additions & 0 deletions packages/aws-appsync/src/platform.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const userAgent = 'react-native';

export { userAgent };

0 comments on commit fb9dea9

Please sign in to comment.