{ "statusCode": 401, "headers": { "Connection": "keep-alive", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Date": "Mon, 15 Jan 2024 14:54:23 GMT", "Server": "nginx", "WWW-Authenticate": "Bearer", "Content-Length": "0" } }
parameters": [ { "name": "new_url", "in": "header", "type": "string", "required": true, "description": "Url for the Host environment", "x-ms-summary": "Host Name" }, { other params here for webhook } ]
public class Script : ScriptBase { public override async Task<HttpResponseMessage> ExecuteAsync() { var originalRequest = this.Context.Request; var originalRequestBody = await originalRequest.Content.ReadAsStringAsync(); var originalRequestUrl = originalRequest.RequestUri; var newRequestUrl = new UriBuilder(originalRequestUrl) { Scheme = "https", Host = "abc.app.example.com" }.Uri; var mainRequest = new HttpRequestMessage(originalRequest.Method, newRequestUrl); mainRequest.Content = new StringContent(originalRequestBody, Encoding.UTF8, "application/json"); foreach (var header in originalRequest.Headers) { mainRequest.Headers.TryAddWithoutValidation(header.Key, header.Value); } var response = await this.Context.SendAsync(mainRequest, this.CancellationToken).ConfigureAwait(continueOnCapturedContext: false); return response; } }
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2