You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using gradle dependency: implementation 'com.github.tomakehurst:wiremock:2.27.2'
My JSON stub mapping is calling a POST URL using proxyBaseUrl and sending the response to transformers (I am writing my own transformer class by extending ResponseTransformer to dynamically change the response based on the response from proxy URL). JSON Stub:
Issue:
I can see the response from proxyBaseUrl as HTTP 200, but when I try printing the body using response.getBodyAsString(), it returns a string in unreadable format. 200 response:
response.getBodyAsString():
How can I read this response in readable format (preferably json), to change the response dynamically using transformer functionality.
response.getBody() method returns a byte array.
response.getBody():
Tried decoding the byte array returned using all StandardCharsets and
new String(response.getBody(), response.getHeaders().getContentTypeHeader().charset());
How can I convert this byte array in a readable format. Thank you in anticipation of a solution.
Suggested Edits
No response
References
No response
The text was updated successfully, but these errors were encountered:
Page
/docs/response-templating/
Details
I am using gradle dependency: implementation 'com.github.tomakehurst:wiremock:2.27.2'
My JSON stub mapping is calling a POST URL using proxyBaseUrl and sending the response to transformers (I am writing my own transformer class by extending ResponseTransformer to dynamically change the response based on the response from proxy URL).
JSON Stub:
Issue:
200 response:
response.getBodyAsString():
How can I read this response in readable format (preferably json), to change the response dynamically using transformer functionality.
response.getBody():
Tried decoding the byte array returned using all StandardCharsets and
new String(response.getBody(), response.getHeaders().getContentTypeHeader().charset());
How can I convert this byte array in a readable format. Thank you in anticipation of a solution.
Suggested Edits
No response
References
No response
The text was updated successfully, but these errors were encountered: