Comments (8)
I'm not really sure what you're asking. Is it to change the way the handlers are constructed? or?
from handlers.
Yes, I'm referring to the construction. I'm saying if the struct supported func ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) you could also expose func(http.Handler)http.Handler using something like the Compose function I wrote above. Then both are available.
from handlers.
I'm happy to create a pull request illustrating the idea if you think it prudent.
from handlers.
I'd prefer if everything in the package stuck to the standard http.Handler API. There's a lot of people going in different directions with approaches to implementing middleware with none of them being the clear winner yet. At least net/http is a common denominator.
from handlers.
Totally reasonable. I actually think the http.Handler -> http.Handler is the nicest api unless something different gets added to net/http. I would like the community to standardize, but I'm sure it will with time. Do you have a list somewhere of handlers people should be writing?
from handlers.
Not really. I've just included ones I've used in my web applications and found to be generally useful, and a few others which users of the package have submitted.
from handlers.
Cool, might be nice to have a roadmap on the wiki or readme of handlers for people to consider writing. For example, I have some caching handlers I use (browser cache, lru cache, memcache) I wrote which I could convert to this format if that is of interest.
from handlers.
I don't really have a particular roadmap or vision beyond "a useful collection of http.Handler types" so if you think you have something useful just propose it :)
from handlers.
Related Issues (20)
- [feature] FileServer handler HOT 2
- [feature] add brotli encoding support in compress handler HOT 3
- [bug] ProxyHeaders breaks gorilla/csrf HOT 1
- [bug] websockets are logged with a status code of 200 instead of 101 HOT 1
- [bug] ProxyHeaders XFF parsing handles whitespace incorrectly
- [question] How to add X-Request-ID in access Log
- [question] Does handler add AllowedOrigins * header by default?
- [feature] Basic Auth handler
- [feature] improve the CPUUtilization and MemoryUtilization
- Incorrect regex in `forRegex`
- [question] upgrade httpsnoop HOT 1
- OPTIONS in Allow for MethodHandler
- The ProxyHeaders middleware is misleading and dangerous
- [BUG] CORS middleware sets `Vary: Origin` header only in some cases HOT 1
- [BUG] Listing Origin as an allowed request header is unnecessary
- [FEATURE] Allow users to disable caching of preflight responses
- [FEATURE] Support Private Network Access
- [BUG] Sometimes missing Vary: Origin header may lead to Web cache poisoning
- [BUG] Allowing methods that are not uppercase should be possible but isn't
- [BUG] Add "Vary" header only if value not already present HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlers.