Skip to content

Commit

Permalink
chore: Remove unnecessary whitespaces in mock_service.bal
Browse files Browse the repository at this point in the history
  • Loading branch information
manodyaSenevirathne committed Aug 12, 2024
1 parent de3a288 commit 69e4e46
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ballerina/tests/mock_service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ listener http:Listener httpListener = new (9090);

http:Service mockService = service object {
resource function post chat/completions(@http:Payload CreateChatCompletionRequest payload) returns CreateChatCompletionResponse|http:BadRequest {

// Validate the request payload
if (payload.messages[0]["content"].toString() is "" || payload.model.toString() is "") {
return http:BAD_REQUEST;
}

// Mock response
// Mock response
CreateChatCompletionResponse response = {
id: "chatcmpl-00000",
choices: [
Expand All @@ -45,12 +45,11 @@ http:Service mockService = service object {
"usage": {"completion_tokens": 11, "prompt_tokens": 13, "total_tokens": 24}
};

return response;
return response;
}
};

function init() returns error? {

if isLiveServer {
log:printInfo("Skiping mock server initialization as the tests are running on live server");
return;
Expand Down

0 comments on commit 69e4e46

Please sign in to comment.