File tree Expand file tree Collapse file tree
http/okhttp/src/test/groovy/com/okta/commons/http/okhttp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,25 +46,30 @@ class OkHttpRequestExecutorTest {
4646 void testToSdkResponseWithNullContentString () {
4747
4848 def requestAuthenticator = mock(RequestAuthenticator )
49-
49+
5050 def clientConfiguration = new HttpClientConfiguration ()
5151 clientConfiguration. setRequestAuthenticator(requestAuthenticator)
5252 def requestExecutor = new OkHttpRequestExecutor (clientConfiguration)
5353
5454 def okRequest = new okhttp3.Request.Builder ()
55- .url(" https://test.example.com" )
56- .build()
55+ .url(" https://test.example.com" )
56+ .build()
57+
58+ def emptyBody = ResponseBody . create(null , " " )
59+
5760 def okResponse = new okhttp3.Response.Builder ()
58- .body(null )
59- .code(200 )
60- .message(" OK" )
61- .request(okRequest)
62- .protocol(Protocol . HTTP_1_1 )
63- .build()
61+ .body(emptyBody )
62+ .code(200 )
63+ .message(" OK" )
64+ .request(okRequest)
65+ .protocol(Protocol . HTTP_1_1 )
66+ .build()
6467
6568 def response = requestExecutor. toSdkResponse(okResponse)
6669
67- assertThat response. body, nullValue()
70+ // FIX: Update assertions to check for a non-null, empty stream
71+ assertThat response. body, notNullValue()
72+ assertThat response. body. read(), is(-1 )
6873 assertThat response. httpStatus, is(200 )
6974 }
7075
You can’t perform that action at this time.
0 commit comments