cancel
Showing results for 
Search instead for 
Did you mean: 

Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

Highlighted
New Contributor

Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

I am trying to get the content of HTTP PUT request (take text from request body) to compose dynamic response in REST Mock Service.
mockRequest.requestContent is always NULL if PUT method is used although request is sent with some text in request body and Content-Length is set with appropriate value in HTTP headers.
If HTTP action is changed to POST then mockRequest.requestContent is populated correctly.

Is it a bug or do I miss something?
12 REPLIES 12
Highlighted
Moderator

Re: Mock Service: mockRequest.requestContent is NULL (HTTP P

Hello,

Unfortunately, this is a bug. There is an internal defect of SOAP-2344 for this issue. This applies for the PUT and DELETE methods for a REST mock service.


Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP P

mrJames, Is there any estimate date when it will be fixed or the link to the bug in tracking system to check its status updates?
Highlighted
Regular Visitor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP P

I have the same issue with SoapUI 5.1.2 and 5.2.0. 

I need to read the content of a PUT message.

Is a workaround exist for this issue ?

Highlighted
New Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

I have the same issue with SoapUI 5.2.1 when I try to read the content of a PUT message.

 

Has this bug been fixed in any SOAP UI release ? Or is there a workaround for this issue ?

Highlighted
New Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

Anyone got the solution for this? Even I am seeing the same issue

Highlighted
New Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

Can anyone please suggest in which version this issue is resolved?

Highlighted
Occasional Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

Hi 

i found one workaround for the problem. We are getting null output for mockRequest.getRequestContent() for PUT request

 

The workaround would be to use the following code

 

InputStream is = mockRequest.request.inputStream
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
StringBuilder sb = new StringBuilder()
while((s=br.readLine())!=null) {
sb.append(s)
}
String payLoad = sb.toString()
log.info payLoad

 

 

Highlighted
New Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

The workaround works smoothly. However, if you need re-get the content down the road, you can't since the stream cannot be consumed twice. Hope there's a real solution from smartbear.

Highlighted
Contributor

Re: Mock Service: mockRequest.requestContent is NULL (HTTP PUT)

NOT WORKS. I am using the ReadyAPI v 2.8.

 

I am unable to read request body.. So unable to return valid response to my Application under test =  I am unable to test it = unable to use this tool for testing.

 

This topic is here sooo loooong.. And no solution? I am surprised. So nobody from SmartBear was working on it? It means, that we are paing for licenses, but no effect?

 

Please can somebody tell me, how to read POST body request ? because I must return some string value from it back to AUT.. 

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors