Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed Sep 12, 2024
1 parent 288fd49 commit 7cc3108
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/java/co/omise/testutils/TestInterceptor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.omise.testutils;

import org.jetbrains.annotations.NotNull;

import co.omise.OmiseTest;
import okhttp3.*;

Expand All @@ -16,6 +18,7 @@ public TestInterceptor(OmiseTest test) {
this.test = test;
}

@NotNull
@Override
public Response intercept(Chain chain) {
Request request = chain.request();
Expand All @@ -32,10 +35,12 @@ public Response intercept(Chain chain) {
Response.Builder builder = new Response.Builder()
.request(request)
.protocol(Protocol.HTTP_1_1)
// Message is not optional anymore and this is only for testing
.message("")
.code(code);

if (responseData != null) {
builder = builder.body(ResponseBody.create(jsonMediaType, responseData));
builder = builder.body(ResponseBody.Companion.create(responseData, jsonMediaType));
}

return lastResponse = builder.build();
Expand Down

0 comments on commit 7cc3108

Please sign in to comment.