Start refusal: bound the body read, survive undecodable bodies, pin the code length cap
Soul pass on c085cead: a refusal with an unsupported charset escaped as a 500, the body was read without a bound, and the 64-character cap was untested.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c085cead9d
commit
87a1bb6b3b
3 changed files with 66 additions and 10 deletions
|
|
@ -207,6 +207,9 @@ public sealed class FakeHeimdall : HttpMessageHandler
|
|||
|
||||
public HttpStatusCode StartStatus { get; set; } = HttpStatusCode.OK;
|
||||
|
||||
/// <summary>A raw Content-Type header for the start answer (for example a charset .NET cannot decode); null means application/json.</summary>
|
||||
public string? StartContentType { get; set; }
|
||||
|
||||
public string StartBody { get; set; } =
|
||||
"""{"authorizationUrl":"https://heimdall.test/oauth/discord/authorize?state=fixture"}""";
|
||||
|
||||
|
|
@ -263,10 +266,9 @@ public sealed class FakeHeimdall : HttpMessageHandler
|
|||
};
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(StartStatus)
|
||||
{
|
||||
Content = new StringContent(StartBody, Encoding.UTF8, "application/json")
|
||||
};
|
||||
var content = new ByteArrayContent(Encoding.UTF8.GetBytes(StartBody));
|
||||
content.Headers.TryAddWithoutValidation("Content-Type", StartContentType ?? "application/json");
|
||||
return new HttpResponseMessage(StartStatus) { Content = content };
|
||||
}
|
||||
|
||||
if (request.Method == HttpMethod.Post && path == "/v1/apps/bifrost/auth-completions/redeem")
|
||||
|
|
|
|||
Loading…
Reference in a new issue