Skip to content

Commit

Permalink
Add Tagged value fix from Daniel
Browse files Browse the repository at this point in the history
  • Loading branch information
isaksky committed Dec 16, 2016
1 parent 342c7ea commit 4c43bd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transit_json_marshaler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ emit_tagged(#tagged_value{tag=Tag, rep=Rep}, S0) ->
emit_encoded(Tag, Rep, Env) ->
Handler = transit_write_handlers:handler(Rep),
RepFun = Handler#write_handler.rep,
emit_tagged(#tagged_value{tag=Tag, rep=RepFun(Rep)}, Env).
emit_tagged(#tagged_value{tag=Tag, rep=Rep}, Env).

-spec emit_string(bitstring(), bitstring(), S) ->
{bitstring(), S} when S::transit_marshaler:env().
Expand Down
11 changes: 11 additions & 0 deletions src/transit_writer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ canonicalize(#{ format := _F, handler := _H } = M) -> M;
canonicalize(#{ format := _F } = M) -> canonicalize(M#{ handler => ?MODULE });
canonicalize(#{ handler := _H } = M) -> canonicalize(M#{ format => json });
canonicalize(#{}) -> #{ format => json, handler => ?MODULE }.

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

write_bugged_test_() ->
Tests = [{<<"[\"~#om/id\",\"~u565a051a-3acc-4168-bcdc-ab59438e5e86\"]">>,
transit_types:tv(<<"om/id">>, transit_types:uuid(<<"565a051a-3acc-4168-bcdc-ab59438e5e86">>))}
],
[fun() -> Res = write(Rep, #{format => json})
end || {Res, Rep} <- Tests].
-endif.

0 comments on commit 4c43bd0

Please sign in to comment.