Skip to content

Commit

Permalink
Change return format for provided encodings and charsets. Issue #14
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell committed Jan 15, 2014
1 parent 8eccbab commit 1d9adea
Show file tree
Hide file tree
Showing 5 changed files with 547 additions and 449 deletions.
4 changes: 4 additions & 0 deletions include/wm_reqdata.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
req_body,
resp_redirect :: boolean(),
resp_headers,
resp_content_encoding :: string(),
resp_transfer_encoding :: undefined | {string(),function()},
resp_content_type :: string(),
resp_chosen_charset :: string(),
resp_body :: any(),
resp_range :: atom(),
host_tokens :: [string()],
Expand Down
23 changes: 16 additions & 7 deletions src/webmachine_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ default(process_post) ->
false;
default(language_available) ->
true;

% The default setting is needed for non-charset responses such as image/png
% An example of how one might do actual negotiation:
% ["iso-8859-1", "utf-8"];
default(charsets_provided) ->
no_charset; % this atom causes charset-negotation to short-circuit
% the default setting is needed for non-charset responses such as image/png
% an example of how one might do actual negotiation
% [{"iso-8859-1", fun(X) -> X end}, {"utf-8", make_utf8}];
default(encodings_provided) ->
[{"identity", fun(X) -> X end}];
% this is handy for auto-gzip of GET-only resources:
% [{"identity", fun(X) -> X end}, {"gzip", fun(X) -> zlib:gzip(X) end}];

% The content variations available to the controller.
default(content_encodings_provided) ->
["identity"];

% How the content is transferred, this is handy for auto-gzip of GET-only resources.
% "identity" and "chunked" are always available to HTTP/1.1 clients.
% Example:
% [{"gzip", fun(X) -> zlib:gzip(X) end}];
default(transfer_encodings_provided) ->
[{"gzip", fun(X) -> zlib:gzip(X) end}];

default(variances) ->
[];
default(is_conflict) ->
Expand Down
Loading

0 comments on commit 1d9adea

Please sign in to comment.