Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 8f736ab

Browse files
authored
Replace jsx with built-in JSON module (#13)
1 parent 00efddd commit 8f736ab

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-22.04
1717
strategy:
1818
matrix:
19-
otp_version: ['27.1', '26.2']
19+
otp_version: ['27.1']
2020

2121
steps:
2222
- uses: actions/checkout@v4
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-22.04
4141
strategy:
4242
matrix:
43-
otp_version: ['27.1', '26.2']
43+
otp_version: ['27.1']
4444

4545
steps:
4646
- uses: actions/checkout@v4

rebar.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
{lager, "3.9.2"},
1515
folsom,
1616
cowboy,
17-
jsx,
1817
dns_erlang,
1918
erldns
2019
]}.

rebar.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
{<<"folsom">>,{pkg,<<"folsom">>,<<"1.0.0">>},0},
99
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
1010
{<<"iso8601">>,{pkg,<<"iso8601">>,<<"1.3.4">>},1},
11-
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},0},
1211
{<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0},
1312
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1},
1413
{<<"recon">>,{pkg,<<"recon">>,<<"2.5.5">>},1}]}.
@@ -23,7 +22,6 @@
2322
{<<"folsom">>, <<"50ECC998D2149939F1D5E0AA3E32788F8ED16A58E390D81B5C0BE4CC4EF25589">>},
2423
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
2524
{<<"iso8601">>, <<"7B1F095F86F6CF65E1E5A77872E8E8BF69BD58D4C3A415B3F77D9CC9423ECBB9">>},
26-
{<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>},
2725
{<<"lager">>, <<"4CAB289120EB24964E3886BD22323CB5FEFE4510C076992A23AD18CF85413D8C">>},
2826
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
2927
{<<"recon">>, <<"C108A4C406FA301A529151A3BB53158CADC4064EC0C5F99B03DDB8C0E4281BDF">>}]},
@@ -37,7 +35,6 @@
3735
{<<"folsom">>, <<"DD6AB97278E94F9E4CFC43E188224A7B8C7EAEC0DD2E935007005177F3EEBB0E">>},
3836
{<<"goldrush">>, <<"99CB4128CFFCB3227581E5D4D803D5413FA643F4EB96523F77D9E6937D994CEB">>},
3937
{<<"iso8601">>, <<"A334469C07F1C219326BC891A95F5EEC8EB12DD8071A3FFF56A7843CB20FAE34">>},
40-
{<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>},
4138
{<<"lager">>, <<"7F904D9E87A8CB7E66156ED31768D1C8E26EBA1D54F4BC85B1AA4AC1F6340C28">>},
4239
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
4340
{<<"recon">>, <<"632A6F447DF7CCC1A4A10BDCFCE71514412B16660FE59DECA0FCF0AA3C054404">>}]}

src/erldns_admin_root_handler.erl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,18 @@ to_text(Req, State) ->
4747
to_json(Req, State) ->
4848
ZoneNamesAndVersionsForJson = lists:map(
4949
fun({Name, Version}) ->
50-
[{<<"name">>, Name}, {<<"version">>, Version}]
50+
#{<<"name">> => Name, <<"version">> => Version}
5151
end,
5252
erldns_zone_cache:zone_names_and_versions()
5353
),
5454

55-
Body = jsx:encode([
56-
{<<"erldns">>, [
57-
{<<"zones">>, [
58-
{<<"count">>, length(ZoneNamesAndVersionsForJson)},
59-
{<<"versions">>, ZoneNamesAndVersionsForJson}
60-
]}
61-
]}
62-
]),
63-
{Body, Req, State}.
55+
Body = json:encode(#{
56+
<<"erldns">> => #{
57+
<<"zones">> => #{
58+
<<"count">> => length(ZoneNamesAndVersionsForJson),
59+
<<"versions">> => ZoneNamesAndVersionsForJson
60+
}
61+
}
62+
}),
63+
64+
{iolist_to_binary(Body), Req, State}.

src/erldns_admin_zone_control_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ to_json(Req, State) ->
5555
case Action of
5656
_ ->
5757
lager:debug("Unsupported action: ~p (name: ~p)", [Action, Name]),
58-
{jsx:encode([]), Req, State}
58+
{json:encode(#{}), Req, State}
5959
end.

0 commit comments

Comments
 (0)