Closed ipichris closed 3 years ago
Hi @ipichris Thanks for finding that issues. I will try to look on it during the weekend.
I've added new method doReturnWithStatus
which will set response status and no response entity. Old one doReturnStatus
is marked as deprected.
New versions should be visible in Maven this week.
Thank you very much, i will update when the new version is released.
I just updated to 1.10.0 and it works as expected, thx again.
https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpResponse.html#getEntity() => Returns: the response entity, or null if there is none
I couldn't find a way to use HttpClientMock to create an response without entity so i would get an null reponse from this method. I tried "doReturn(200, null)" but this results in an exception in Apache HttpClient
java.lang.IllegalArgumentException: Source string may not be null at org.apache.http.util.Args.notNull(Args.java:54) at org.apache.http.entity.StringEntity.<init>(StringEntity.java:65) at org.apache.http.entity.StringEntity.<init>(StringEntity.java:132) at com.github.paweladamski.httpclientmock.action.StringResponse.getResponse(StringResponse.java:40) at com.github.paweladamski.httpclientmock.Rule.nextResponse(Rule.java:43) at com.github.paweladamski.httpclientmock.HttpClientMock.getHttpResponse(HttpClientMock.java:273) at com.github.paweladamski.httpclientmock.HttpClientMock.doExecute(HttpClientMock.java:248)