deepkit-framework icon indicating copy to clipboard operation
deepkit-framework copied to clipboard

HttpHeader are case sensitive when used in TestingFacade requests

Open pxDot opened this issue 4 months ago • 0 comments

Using HttpHeader as controller param seems to be case sensitive but should be case insensitive. Seems to only be an issue when sending requests via a TestingFacade app.

@http.POST('testcontrollerfunction')
async testControllerFunction(authorization: HttpHeader<string>): Promise<{ data: string }> {
  return new JSONResponse({ data: authorization });
}
test('header should not be case sensitive', async () => {
  const response = await testApp.request(HttpRequest.POST('/testcontrollerfunction').header('Authorization', 'teststring'));
  assert.strictEqual((await response.json).data, 'teststring'); // fails

  const response2 = await testApp.request(HttpRequest.POST('/testcontrollerfunction').header('authorization', 'teststring'));
  assert.strictEqual((await response.json).data, 'teststring'); // OK
});

pxDot avatar Jun 06 '25 06:06 pxDot