johnny-morrice / godelbrot

Unix-style Mandelbrot set renderer in Golang
MIT License
8 stars 1 forks source link

restclient lib should communicate its HTTP needs with loose coupling #17

Closed johnny-morrice closed 8 years ago

johnny-morrice commented 8 years ago

The restclient lib should communicate its needs to GET and POST with loose coupling.

This is because certain types of clients may need to handle their requests in a manner that cannot be accomplished with a single method call. E.g. a javascript wrapper should use the standard ajax methods, which are async and have their own callbacks.

I feel like this should be done with channels, for input and output. These receive and send simple data-only structs. E.g.

Output:

{ "method": "POST", "url": "blah", "content-type": "application/json", "data": "blahblahblah" }

Input:

{ "output": as per above, "error": null, "http-response": { "status": 200 } }

johnny-morrice commented 8 years ago

Using a fairly standard pattern where the user receives a channel that dispenses:

johnny-morrice commented 8 years ago

Supported with e77df05