Skip to content

Commit 80a792f

Browse files
Set default responseType to json
1 parent 19d38e7 commit 80a792f

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

readme.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ import got4aws from 'got4aws';
4444
const got = got4aws();
4545

4646
(async () => {
47-
const {body} = await got.get('https://12abc34.execute-api.us-east-1.amazonaws.com/v0', {
48-
responseType: 'json'
49-
});
47+
const {body} = await got.get('https://12abc34.execute-api.us-east-1.amazonaws.com/v0');
5048

5149
console.log(body);
5250
//=> {status: 'ok'}
@@ -64,9 +62,7 @@ const got = got4aws({
6462
});
6563

6664
(async () => {
67-
const {body} = await got.get('https://12abc34.execute-api.us-east-1.amazonaws.com/v0', {
68-
responseType: 'json'
69-
});
65+
const {body} = await got.get('https://12abc34.execute-api.us-east-1.amazonaws.com/v0');
7066

7167
console.log(body);
7268
//=> {status: 'ok'}
@@ -85,9 +81,7 @@ const got = got4aws({
8581
});
8682

8783
(async () => {
88-
const {body} = await got.get('https://api.unicorn.com/v0', {
89-
responseType: 'json'
90-
});
84+
const {body} = await got.get('https://api.unicorn.com/v0');
9185

9286
console.log(body);
9387
//=> {status: 'ok'}
@@ -99,7 +93,7 @@ const got = got4aws({
9993

10094
### got4aws(options?)
10195

102-
Returns a [`Got`](https://github.com/sindresorhus/got) instance.
96+
Returns a [`Got`](https://github.com/sindresorhus/got) instance with a default `responseType` set to `json`.
10397

10498
#### options
10599

source/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const got4aws = (awsOptions: GotAWSOptions = {}) => {
4343
const chain = new AWS.CredentialProviderChain(credentialProviders as any);
4444

4545
return got.extend({
46+
responseType: 'json',
4647
hooks: {
4748
beforeRequest: [
4849
async options => {

0 commit comments

Comments
 (0)