Rest Client - How can I pass body arguments in POST request
I am trying to test REST interface with the pycharm rest client tool. I am able to send data as query arguments but not as request body arguments. As soon as I mark "request body->text" post request comes to the server empty.
Following is a copy of exported post request:
<RestClientRequest>
<option name="biscuits">
<list />
</option>
<option name="httpMethod" value="POST" />
<option name="urlBase" value="http://experimental:8080" />
<option name="urlPath" value="/users/22/" />
<option name="headers">
<list>
<KeyValuePair>
<option name="key" value="Accept" />
<option name="value" value="*/*" />
</KeyValuePair>
<KeyValuePair>
<option name="key" value="Cache-Control" />
<option name="value" value="no-cache" />
</KeyValuePair>
</list>
</option>
<option name="parameters">
<list>
<KeyValuePair>
<option name="key" value="req_param" />
<option name="value" value="work" />
</KeyValuePair>
</list>
</option>
<option name="parametersEnabled" value="true" />
<option name="haveTextToSend" value="true" />
<option name="haveFileToSend" value="false" />
<option name="isFileUpload" value="false" />
<option name="textToSend" value="body_param="NeverArraives"" />
<option name="filesToSend" value="" />
</RestClientRequest>
Any help is greatly appreciated.
Following is a copy of exported post request:
<RestClientRequest>
<option name="biscuits">
<list />
</option>
<option name="httpMethod" value="POST" />
<option name="urlBase" value="http://experimental:8080" />
<option name="urlPath" value="/users/22/" />
<option name="headers">
<list>
<KeyValuePair>
<option name="key" value="Accept" />
<option name="value" value="*/*" />
</KeyValuePair>
<KeyValuePair>
<option name="key" value="Cache-Control" />
<option name="value" value="no-cache" />
</KeyValuePair>
</list>
</option>
<option name="parameters">
<list>
<KeyValuePair>
<option name="key" value="req_param" />
<option name="value" value="work" />
</KeyValuePair>
</list>
</option>
<option name="parametersEnabled" value="true" />
<option name="haveTextToSend" value="true" />
<option name="haveFileToSend" value="false" />
<option name="isFileUpload" value="false" />
<option name="textToSend" value="body_param="NeverArraives"" />
<option name="filesToSend" value="" />
</RestClientRequest>
Any help is greatly appreciated.
2 comments
Sort by
Date
Votes
You might need to set the request header Content-Type: text/xml or something similar.
Thank you. Adding "Content-Type" field solved the problem.
Please sign in to leave a comment.