diff --git a/packages/aws-appsync/CHANGELOG.md b/packages/aws-appsync/CHANGELOG.md index a5e0ecc1..42174d4a 100644 --- a/packages/aws-appsync/CHANGELOG.md +++ b/packages/aws-appsync/CHANGELOG.md @@ -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) diff --git a/packages/aws-appsync/src/link/auth-link.js b/packages/aws-appsync/src/link/auth-link.js index d949683e..ddd0991a 100644 --- a/packages/aws-appsync/src/link/auth-link.js +++ b/packages/aws-appsync/src/link/auth-link.js @@ -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', diff --git a/packages/aws-appsync/src/platform.js b/packages/aws-appsync/src/platform.js new file mode 100644 index 00000000..cb528789 --- /dev/null +++ b/packages/aws-appsync/src/platform.js @@ -0,0 +1,3 @@ +const userAgent = ''; + +export { userAgent }; diff --git a/packages/aws-appsync/src/platform.native.js b/packages/aws-appsync/src/platform.native.js new file mode 100644 index 00000000..51c52c8c --- /dev/null +++ b/packages/aws-appsync/src/platform.native.js @@ -0,0 +1,3 @@ +const userAgent = 'react-native'; + +export { userAgent };