Merge pull request #1076 from visortelle/patch-1

Fix undefined request body when body is a valid JSON falsy value: false or 0, "".
This commit is contained in:
Ferdi Koomen 2022-06-13 21:41:19 +02:00 committed by GitHub
commit aa20f9e17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
const getRequestBody = (options: ApiRequestOptions): any => {
if (options.body) {
if (options.body !== undefined) {
if (options.mediaType?.includes('/json')) {
return JSON.stringify(options.body)
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {