add a bunch of authentication stuff
This commit is contained in:
parent
996e59f49a
commit
aca83fa1ef
22 changed files with 681 additions and 28 deletions
|
@ -30,12 +30,12 @@ public partial class RequestSigningService
|
|||
if (!resp.IsSuccessStatusCode)
|
||||
{
|
||||
var error = await resp.Content.ReadAsStringAsync();
|
||||
throw new FoxchatError.OutgoingFederationError($"Request to {domain}/{requestPath} returned an error", DeserializeObject<ApiError>(error));
|
||||
throw new FoxchatError.OutgoingFederationError($"Request to {domain}{requestPath} returned an error", DeserializeObject<ApiError>(error));
|
||||
}
|
||||
|
||||
var bodyString = await resp.Content.ReadAsStringAsync();
|
||||
return DeserializeObject<T>(bodyString)
|
||||
?? throw new FoxchatError.OutgoingFederationError($"Request to {domain}/{requestPath} returned invalid response body");
|
||||
?? throw new FoxchatError.OutgoingFederationError($"Request to {domain}{requestPath} returned invalid response body");
|
||||
}
|
||||
|
||||
private HttpRequestMessage BuildHttpRequest(HttpMethod method, string domain, string requestPath, string? userId = null, object? bodyData = null)
|
||||
|
@ -55,9 +55,7 @@ public partial class RequestSigningService
|
|||
if (userId != null)
|
||||
request.Headers.Add(USER_HEADER, userId);
|
||||
if (body != null)
|
||||
{
|
||||
request.Content = new StringContent(body, new MediaTypeHeaderValue("application/json", "utf-8"));
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue