mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
[got] Allow primitive types in JSON body for POST requests (#27109)
This commit is contained in:
committed by
Mohamed Hegazy
parent
2aad925037
commit
03eede6951
@@ -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'));
|
||||
|
||||
Vendored
+1
-1
@@ -100,7 +100,7 @@ declare namespace got {
|
||||
}
|
||||
|
||||
interface GotJSONOptions extends GotOptions<string | null> {
|
||||
body?: object;
|
||||
body?: any;
|
||||
form?: boolean;
|
||||
json: true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user