aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_rest.erl
AgeCommit message (Collapse)Author
2012-07-24Improve typespecsLoïc Hoguin
2012-07-22Remove an useless todoLoïc Hoguin
2012-07-21REST: Normalize content types acceptedLoïc Hoguin
Same as content types provided, we accept the <<"application/json">> form.
2012-07-21REST: Fix charset matchingLoïc Hoguin
2012-05-23Update version to 0.6.00.6.0Loïc Hoguin
Also update the CHANGELOG and copyright years.
2012-04-01Convert request to proplist when loggingMagnus Klaar
2012-03-13Merge branch 'content-type-accepted-asterisk-atom' of ↵Loïc Hoguin
https://github.com/dysinger/cowboy Added a comment explaining the '*' always matching.
2012-03-08If we have a mapping to '*' then use it as the default catch all acceptTim Dysinger
2012-02-29Tests and fixes for the generate_etag/2 callbackMagnus Klaar
The return value from the generate_etag/2 callback is expected to be a binary tagged with either weak or strong. This binary is quoted, and may be prefixed with W/ before it is set as the value of the ETag header in the response. For backwards compatibility with older handlers where the return value was expected to be a quoted binary a function has been added to parse any return values that are untagged binaries. All untagged binaries are expected to be a valid value for the ETag header.
2012-02-27Remove the redundant include/ from -include("http.hrl")Loïc Hoguin
2012-02-20REST: Only send 201 when a new resource is created on POSTLoïc Hoguin
2012-01-26Handle delete better when no delete_resource function is implementedTom Burdick
2012-01-23Add {halt, Req, State} return value to most REST callbacksLoïc Hoguin
Excluding generate_etag, last_modified, expires and variances.
2012-01-23Rename a lot of HandlerState2 variables to HandlerStateLoïc Hoguin
2012-01-23Improve the return value for cowboy_http_rest:upgrade/4Loïc Hoguin
2012-01-09Make REST handlers' put_resource accept true or false return valuesLoïc Hoguin
Followup to 0bb23f2400ed0b65834913c8522a978d986f1f92. As discussed in #119.
2012-01-06Make REST handlers' process_post accept true or false return valuesLoïc Hoguin
They should return true when it has been processed successfully, or false otherwise, in which case a 500 error is sent. Fixes #119.
2011-12-28Add cowboy_http_req:set_resp_body_fun/3 to restMagnus Klaar
2011-12-26Use calendar date and time types exported since R14B04Loïc Hoguin
Removes the cowboy_clock:date/0, time/0 and datetime/0 exported types.
2011-12-22Remove outdated @todo notes and update anotherLoïc Hoguin
2011-12-19create_path now returns a path, not an URILoïc Hoguin
Also add the new 'put_path' metadata information to the request before entering the put_resource step (which proceeds to call content_types_accepted and then the chosen content type's callback, which is expected to use the 'put_path' value as the path to the new resource instead of the original request path, because it may have been changed by the create_path call.
2011-12-19Add meta/2 and meta/3 to cowboy_http_req to save useful protocol informationLoïc Hoguin
* cowboy_http_protocol now defines 'websocket_version' as metadata. * cowboy_http_rest now defines 'media_type', 'language', 'charset' as metadata.
2011-12-12Merge branch 'variances-fix' of github.com:klaar/cowboyLoïc Hoguin
2011-12-12Fixes match_media_type in cowboy_http_restLoïc Hoguin
Based on the patch from Heinz N. Gies. The main change is that his patch accept values such as */plain which we do not want. Fixes issue #105.
2011-12-12adds webmachine format content type handlingalisdair sullivan
2011-12-11update cowboy_http_rest:variances/2Magnus Klaar
Fix pattern in case statement that was intended to strip away the first comma separating the values in the variance header. Update generation of variance list to use more idiomatic erlang. Pattern match on list structure over using erlang:length/1 to compute length.
2011-12-08Fix the process_post/2 function in cowboy_http_restLoïc Hoguin
2011-12-08Add more documentation to the REST protocol handlerLoïc Hoguin
2011-12-08Add default values to known_methods and allowed_methodsLoïc Hoguin
Only allowing HEAD and GET requests by default.
2011-12-08Allow HTTP protocol upgrades to use keepaliveLoïc Hoguin
REST needed this to be allowed to chain requests on the same connection.
2011-12-05Add experimental Webmachine based REST protocol supportLoïc Hoguin
As with everything experimental, it probably has a lot of bugs and may not even work. Like Websocket, REST must be upgraded from a standard resource through the init/3 function. A key difference between Webmachine and Cowboy's REST protocol handler is that in Cowboy the resource has direct access to the request object. This makes a small change in a few places where you were expected to return headers or body in Webmachine and are now expected to set them directly yourself if needed (options/2, for example). Another difference is that the functions rest_init/2 will always be called when starting to process a request. Similarly, rest_terminate/2 will be called when the process completes successfully. The Cowboy REST support also includes automatic language selection, thanks to the languages_provided/2 callback. Finally, Cowboy REST expects full URIs to be given at all times, and will not try to reconstruct URIs from fragments. Note that REST requests cannot be chained (keepalive) at this time. This is a design issue in cowboy_http_protocol that will be fixed soon. Check out the source for more details. It has been designed to be very easy to read and understand so if you don't understand something, it's probably a bug. Thanks in advance for all the great bug reports, pull requests and comments you'll forward my way!