Support PATCH for SendHttpRequest action (#3676)
Co-authored-by: BLACKBAUD\Michael.Tims <michael.tims@blackbaud.com>
This commit is contained in:
Родитель
f711f1e29d
Коммит
c01e386831
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"iconBrandColor": "#71BF43",
|
||||
"iconBrandColor": "#0CD973",
|
||||
"scriptOperations": [
|
||||
"SendHttpRequest"
|
||||
],
|
||||
|
|
|
@ -35,14 +35,6 @@ public class Script : ScriptBase
|
|||
var headers = json["headers"]?.ToString();
|
||||
var body = json["body"]?.ToString();
|
||||
|
||||
if (method.Equals("PATCH", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// PATCH is not supported
|
||||
var response = new HttpResponseMessage(HttpStatusCode.BadRequest);
|
||||
response.Content = CreateJsonErrorResponse($"Unsupported HTTP method '{method}'");
|
||||
return response;
|
||||
}
|
||||
|
||||
var uriBuilder = new UriBuilder("https://api.sky.blackbaud.com");
|
||||
uriBuilder.Path = path;
|
||||
|
||||
|
@ -96,7 +88,7 @@ public class Script : ScriptBase
|
|||
}
|
||||
|
||||
// set the request body
|
||||
if (new [] {"PUT", "POST"}.Contains(method, StringComparer.OrdinalIgnoreCase) && (!string.IsNullOrWhiteSpace(body)))
|
||||
if (new [] {"PUT", "POST", "PATCH"}.Contains(method, StringComparer.OrdinalIgnoreCase) && (!string.IsNullOrWhiteSpace(body)))
|
||||
{
|
||||
this.Context.Request.Content = CreateJsonContent(body);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче