mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Fix: API Key added in the body instead of param (#142)
* Fix: Add the missing API Key on send chat calls. * Fix: Wrongly added the apiKey in the body instead of the param * Update TikTokLiveHttpClient.java We do not need to null check as Eulerstream verifies anyway so we can just pass whatever the value is. * Update TikTokLiveHttpClient.java Revert to your method, but using Header instead of Param, since HttpClient does not allow null values! Co-authored-by: mbayou <mathieu@novasquare.io> Co-authored-by: kohlerpop1 <70915561+kohlerpop1@users.noreply.github.com>
This commit is contained in:
@@ -204,13 +204,11 @@ public class TikTokLiveHttpClient implements LiveHttpClient
|
|||||||
body.addProperty("sessionId", clientSettings.getSessionId());
|
body.addProperty("sessionId", clientSettings.getSessionId());
|
||||||
body.addProperty("ttTargetIdc", clientSettings.getTtTargetIdc());
|
body.addProperty("ttTargetIdc", clientSettings.getTtTargetIdc());
|
||||||
body.addProperty("roomId", roomInfo.getRoomId());
|
body.addProperty("roomId", roomInfo.getRoomId());
|
||||||
|
HttpClientBuilder builder = httpFactory.client(TIKTOK_CHAT_URL)
|
||||||
|
.withHeader("Content-Type", "application/json");
|
||||||
if (clientSettings.getApiKey() != null)
|
if (clientSettings.getApiKey() != null)
|
||||||
body.addProperty("apiKey", clientSettings.getApiKey());
|
builder.withHeader("apiKey", clientSettings.getApiKey());
|
||||||
var result = httpFactory.client(TIKTOK_CHAT_URL)
|
var result = builder.withBody(HttpRequest.BodyPublishers.ofString(body.toString())).build().toJsonResponse();
|
||||||
.withHeader("Content-Type", "application/json")
|
|
||||||
.withBody(HttpRequest.BodyPublishers.ofString(body.toString()))
|
|
||||||
.build()
|
|
||||||
.toJsonResponse();
|
|
||||||
return result.isSuccess();
|
return result.isSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user