Skip to content

Commit b80f561

Browse files
Fixed errors for changing Content Type in the Example
Signed-off-by: ronodhirSoumik <ronodhirsoumik@gmail.com>
1 parent 5f64a61 commit b80f561

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/core/plugins/oas3/reducers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ export default {
5454
},
5555
[UPDATE_REQUEST_CONTENT_TYPE]: (state, { payload: { value, pathMethod } } ) =>{
5656
let [path, method] = pathMethod
57+
let currentBodyValue = state.getIn([ "requestData", path, method, "bodyValue" ])
58+
let isPrevForm = Map.isMap(currentBodyValue)
59+
let isNewForm = value === "application/x-www-form-urlencoded" || value.indexOf("multipart/") === 0
60+
if (isPrevForm !== isNewForm) {
61+
state = state.deleteIn([ "requestData", path, method, "bodyValue" ])
62+
state = state.deleteIn([ "requestData", path, method, "errors" ])
63+
}
5764
return state.setIn( [ "requestData", path, method, "requestContentType" ], value)
5865
},
5966
[UPDATE_RESPONSE_CONTENT_TYPE]: (state, { payload: { value, path, method } } ) =>{

0 commit comments

Comments
 (0)