Comparing version 4.0.1 to 5.0.0
'use strict'; | ||
const got = require('got'); | ||
const isPlainObj = require('is-plain-obj'); | ||
@@ -31,2 +32,9 @@ function ghGot(path, opts) { | ||
// TODO: remove this when Got eventually supports it | ||
// https://github.com/sindresorhus/got/issues/174 | ||
if (isPlainObj(opts.body)) { | ||
opts.headers['content-type'] = 'application/json'; | ||
opts.body = JSON.stringify(opts.body); | ||
} | ||
const url = /^https?/.test(path) ? path : opts.endpoint + path; | ||
@@ -33,0 +41,0 @@ |
{ | ||
"name": "gh-got", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Convenience wrapper for `got` to interact with the GitHub API", | ||
@@ -36,3 +36,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"got": "^6.2.0" | ||
"got": "^6.2.0", | ||
"is-plain-obj": "^1.1.0" | ||
}, | ||
@@ -42,2 +43,3 @@ "devDependencies": { | ||
"get-stream": "^2.0.0", | ||
"nock": "^8.0.0", | ||
"xo": "*" | ||
@@ -44,0 +46,0 @@ }, |
@@ -77,5 +77,11 @@ # gh-got [![Build Status](https://travis-ci.org/sindresorhus/gh-got.svg?branch=master)](https://travis-ci.org/sindresorhus/gh-got) | ||
### body | ||
Type: `Object` | ||
Can be specified as a plain object and will be serialized as JSON with the appropriate headers set. | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5264
54
87
2
4
+ Addedis-plain-obj@^1.1.0
+ Addedis-plain-obj@1.1.0(transitive)