revert: feat: Allow to skip submitting empty values in form data (#5830)

This reverts commit b9b32c9c93.

Refs #6203 #5830
This commit is contained in:
Vladimir Gorej
2020-07-07 15:04:35 +02:00
parent e3b3bf03d4
commit 1b6cb7d1bf
10 changed files with 27 additions and 75 deletions

View File

@@ -5,7 +5,7 @@ import serializeError from "serialize-error"
import isString from "lodash/isString"
import debounce from "lodash/debounce"
import set from "lodash/set"
import { isJSONObject, paramToValue, isEmptyValue } from "core/utils"
import { isJSONObject, paramToValue } from "core/utils"
// Actions conform to FSA (flux-standard-actions)
// {type: string,payload: Any|Error, meta: obj, error: bool}
@@ -401,12 +401,11 @@ export const executeRequest = (req) =>
req.requestContentType = oas3Selectors.requestContentType(pathName, method)
req.responseContentType = oas3Selectors.responseContentType(pathName, method) || "*/*"
const requestBody = oas3Selectors.requestBodyValue(pathName, method)
const requestBodyInclusionSetting = oas3Selectors.requestBodyInclusionSetting(pathName, method)
if(isJSONObject(requestBody)) {
req.requestBody = JSON.parse(requestBody)
} else if(requestBody && requestBody.toJS) {
req.requestBody = requestBody.filter((value, key) => !isEmptyValue(value) || requestBodyInclusionSetting.get(key)).toJS()
req.requestBody = requestBody.toJS()
} else{
req.requestBody = requestBody
}