fix: add missing Allow header on 405 responses (issue #500) - #501
Merged
viniciussanchez merged 1 commit intoJul 6, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acerto issue #500
Esta Pull Request corrige a desconformidade com a especificação HTTP do protocolo RFC 9110 §15.5.6 reportada na issue #500. Quando uma rota era atingida usando um método HTTP não suportado, o Horse retornava o status
405 Method Not Allowed, mas omitia o cabeçalho obrigatórioAllowcontendo a lista de métodos HTTP permitidos pelo recurso.Mudanças Realizadas
Core
Horse.Core.RouterTree.NextCaller.pas):varinline).FCallBack.Keysao gerar a resposta 405 para compor a lista de métodos suportados em maiúsculas (ex:GET, POST), ignorando a diretiva interna de curingamtAny.FResponse.AddHeader('Allow', LAllow).Horse.Core.Router.Radix.pas):LNode.Callbacks.Keyse injeção do cabeçalhoAllowno response antes da execução da pipeline finalizadora do status 405.Testes
Tests.Horse.Core.RouterTree.paseTests.Horse.Core.Router.Radix.pasque simulam requisições de verbos não cadastrados e validam o retorno do cabeçalhoAllow.TestMethodNotAllowedAllowHeader) na unitTests.Integration.HttpMethods.pasusando o cliente HTTP nativo (THTTPClient), levantando o servidor real do Horse e validando as respostas.Tests.Horse.Core.Middleware.paspara isolar o teste específico do compilador FPC (TestFPCLegacyCallbackAssignment), evitando quebra de build no Delphi.Como Testar
Todos os testes unitários e de integração foram validados e passaram com 100% de sucesso localmente.
Para testar, basta executar a suite de testes consolidada via linha de comando ou IDE: