Anonymous avatar Anonymous committed 537c6a0

via Seth Falcon: encoding for PUT/POST response bodies

Comments (0)

Files changed (1)

src/webmachine_decision_core.erl

             end;
         _ ->
             case resource_call(process_post) of
-                true -> stage1_ok;
+                true -> 
+                    encode_body_if_set(),
+                    stage1_ok;
                 {halt, Code} -> respond(Code);
                 Err -> error_response(Err)
             end
         [] -> {respond,415};
         AcceptedContentList ->
             F = hd(AcceptedContentList),
-            resource_call(F)
+            case resource_call(F) of
+                true ->
+                    encode_body_if_set(),
+                    true;
+                Result -> Result
+            end
+    end.
+
+encode_body_if_set() ->
+    case wrcall(has_resp_body) of
+        true ->
+            Body = wrcall(resp_body),
+            wrcall({set_resp_body, encode_body(Body)}),
+            true;
+        _ -> false
     end.
 
 encode_body(Body) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.