scotty-web / wai-middleware-static

WAI middleware that intercepts requests to static files and serves them if they exist.
Other
18 stars 12 forks source link

Only serve static files on HEAD or GET requests #20

Closed sol closed 4 years ago

sol commented 4 years ago

Serving a static file on POST, PUT, etc. is arguably broken.

We now delegate anything other than HEAD or GET to upstream.

This enables relevant use cases, e.g. a static log-in page and an upstream POST handler for it.

If upstream doesn't handle a specific method, it should generate an appropriate status code (currently, ideally 403, as 405 will require some more work in wai-middleware-static to augment any Allow header to be standard compliant).

sol commented 4 years ago

@RyanGlScott CI is green now.

sol commented 4 years ago

@RyanGlScott Hey! Thanks for the review. I addressed everything you mentioned. Let me know if you think there is anything else we want to do.

RyanGlScott commented 4 years ago

Is this something you'd like released to Hackage soon? If not, I'll probably wait until GHC 9.0-alpha1 is announced, which is when I plan to do my next round of Hackage library uploads.

RyanGlScott commented 4 years ago

I've uploaded wai-middlware-static-0.9.0 to Hackage with these changes.

sol commented 4 years ago

@RyanGlScott thanks a lot!