Untitled
unknown
plain_text
a year ago
1.1 kB
9
Indexable
public async Task<HttpResponseMessage> SendToSapAsync(HttpContent httpContent, Uri apiUri, Uri authorizationUri)
{
var httpClient = new HttpClient();
if (this.executionContext.IsDemo)
{
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
string bearerToken = await this.GetAuthorizationBearerToken(authorizationUri).ConfigureAwait(false);
if (httpContent != null)
{
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
}
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", bearerToken);
var httpresponse = await httpClient.PutAsync(apiUri, httpContent).ConfigureAwait(false);
this.logger.LogMessage(
EventLevel.Informational,
string.Empty,
$"GTS Sap Integration - for the input {httpContent} responsecode {httpresponse.StatusCode}");
return httpresponse;
}Editor is loading...
Leave a Comment