Hi everybody.

I would like to get some feedback on set of libraries that I wrote. 
Together they are pluggable, middleware-based HTTP client.


Main idea is to replicate pattern from widely used for server 
implementation. We all know (and love) http.Handlerinterface, which is a 
base for bunch of libraries to extend on. I have also defined Handler 
interface, 
but one that receives context.Context and *http.Request and returns 
*http.Response and error. That is the base of the idea. Middlewares simply 
accept Handler and return other Handler. With some utility stuff (like easy 
way for chaining middlewares, simplified interface for writing of 
middlewares that only modify request or only read response), that is full 
description of cliware <https://github.com/delicb/cliware> library. (Name 
comes from CLIent middleWARE)


Based on cliware, I have written couple of (in my opinion) useful 
middlewares. They are grouped in couple packages in single repository 
<https://github.com/delicb/cliware-middlewares>. There is support for 
authentication, path, cookie and query parameters manipulation, request and 
response body managing, retry...


On top of all that, as a glue and for nicer interface, I have written 
simple http client. It is called GWC <https://github.com/delicb/gwc> (Go 
Web Client).


Main idea is to define reusable middlewares that can be applied to client 
(it will be applied to all requests), group (it will be applied to all 
requests that are part of same group) or request (only applied to single 
request). 


This should make writing clients for large APIs easier and should remove a 
lot of boilerplate code.

For full disclosure, I got an idea (and some middlewares implementation) 
from excellent h2non/gentleman <https://github.com/h2non/gentleman> package. 
I was missing context support (gentleman has context, but it is not 
context.Context from standard library) and I had different idea how 
middlewares and composing should be done.


I would really like to get some feedback, either on design, API, 
implementation, anything really.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to