diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index 1eb2d89aa8..a05812be8d 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -84,6 +84,22 @@ got.patch('todomvc.com', {hostname: 'todomvc'}).then(response => str = response. got.head('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body); got.delete('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body); +// Allow primitive types as JSON body. +{ + got.post('todomvc.com', { + json: true, + body: 1 + }); + got.post('todomvc.com', { + json: true, + body: null + }); + got.post('todomvc.com', { + json: true, + body: 'str' + }); +} + got.stream('todomvc.com').pipe(fs.createWriteStream('index.html')); fs.createReadStream('index.html').pipe(got.stream.get('todomvc.com')); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index f786af118e..6b44aab339 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -100,7 +100,7 @@ declare namespace got { } interface GotJSONOptions extends GotOptions { - body?: object; + body?: any; form?: boolean; json: true; }