Skip to content

Commit

Permalink
Remove unnecessary condition
Browse files Browse the repository at this point in the history
  • Loading branch information
madhukaw committed Aug 22, 2023
1 parent b467557 commit 135bb19
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ballerina/soap_utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import ballerina/mime;
# + soapVersion - The SOAP version of the request
# + headers - SOAP headers as a `map<string|string[]>`
# + return - The SOAP Request sent as `http:Request`
function createHttpRequest(SoapVersion soapVersion, xml|mime:Entity[] body, string soapAction, map<string|string[]>? headers = {})
function createHttpRequest(SoapVersion soapVersion, xml|mime:Entity[] body, string soapAction, map<string|string[]> headers = {})
returns http:Request {
http:Request req = new;
if body is xml {
Expand All @@ -44,10 +44,8 @@ returns http:Request {
req.setHeader(mime:CONTENT_TYPE, mediaType.toString());
}
}
if headers is map<string|string[]> {
foreach string key in headers.keys() {
req.addHeader(key, headers[key].toBalString());
}
foreach string key in headers.keys() {
req.addHeader(key, headers[key].toBalString());
}

return req;
Expand All @@ -68,7 +66,7 @@ function createSoapResponse(http:Response response, SoapVersion soapVersion) ret

string path = "";

function sendReceive(SoapVersion soapVersion, xml|mime:Entity[] body, http:Client httpClient, string soapAction, map<string|string[]>? headers = {}) returns xml|Error {
function sendReceive(SoapVersion soapVersion, xml|mime:Entity[] body, http:Client httpClient, string soapAction, map<string|string[]> headers = {}) returns xml|Error {
http:Request req = createHttpRequest(soapVersion, body, soapAction, headers);
http:Response response;
do {
Expand All @@ -83,7 +81,7 @@ function sendReceive(SoapVersion soapVersion, xml|mime:Entity[] body, http:Clien
}
}

function sendOnly(SoapVersion soapVersion, xml|mime:Entity[] body, http:Client httpClient, string soapAction, map<string|string[]>? headers = {}) returns Error? {
function sendOnly(SoapVersion soapVersion, xml|mime:Entity[] body, http:Client httpClient, string soapAction, map<string|string[]> headers = {}) returns Error? {
http:Request req = createHttpRequest(SOAP11, body, soapAction, headers);
do {
http:Response _ = check httpClient->post(path, req);
Expand Down

0 comments on commit 135bb19

Please sign in to comment.