/__w/shurbej/shurbej/_build/test/cover/aggregate/shurbej_http_stub.html| 1 | -module(shurbej_http_stub). |
|
| 2 | -export([init/2]). |
|
| 3 | |
|
| 4 | %% Returns a static JSON body. Used for endpoints Zotero expects |
|
| 5 | %% but that aren't meaningful for a self-hosted server. |
|
| 6 | init(Req0, #{body := Body} = State) -> |
|
| 7 | 2 | case cowboy_req:method(Req0) of |
| 8 | <<"GET">> -> |
|
| 9 | 1 | Req = shurbej_http_common:json_response(200, Body, Req0), |
| 10 | 1 | {ok, Req, State}; |
| 11 | _ -> |
|
| 12 | 1 | Req = shurbej_http_common:error_response(405, <<"Method not allowed">>, Req0), |
| 13 | 1 | {ok, Req, State} |
| 14 | end. |
|
| Line | Hits | Source |
|---|