Metriche repository
- Star
- (1953 star)
- Metriche merge PR
- (Merge medio 5h 49m) (2 PR mergiate in 30 g)
Descrizione
All of the following compile, but produce code which is nonsense in practice:
-
Static path parts containing slashes:
"api/v1/item" :> Get '[JSON] [Item]This should be done as
"api" :> "v1" :> "item" :> ..., and the resulting API is not functional. -
Case-sensitive headers:
Header "Authentication" String :> Header "authentication" String :> "item" :> Get '[JSON] [Item]According to the RFC, header names are case sensitive. Servant already handles this correctly by assigning the same value to both if either is set, but allowing both to be defined could theoretically result in hard-to-find bugs, as a client can send both at the same time.
-
Duplicate headers:
Header "authentication" String :> Header "authentication" String :> "item" :> Get '[JSON] [Item]Obviously, the resulting server will be passed two identical values. This should not be allowed, as some external code which parses this may rely on the uniqueness of headers.
I'm not sure if it's even technically possible to prevent those from compiling, but it would be nice to have.