Skip to content

Commit

Permalink
Fix: Make example.sk's HTTP server handle sample more clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
faketuna committed Dec 28, 2023
1 parent 5148926 commit e530599
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions example.sk
Original file line number Diff line number Diff line change
Expand Up @@ -184,29 +184,29 @@ on http request received:
set http response {_request}'s header "Invisible" to "This header should not be visible because will be deleted after set."
remove http response {_request}'s header "Invisible"

set {_returnBody} to ""

if {_method} is "DELETE":
reply {_request} with body "{""method"":""DELETE""}" and response code 200
exit
set {_returnBody} to "{""method"":""DELETE""}"

if {_method} is "GET":
reply {_request} with body "{""method"":""GET""}" and response code 200
exit
set {_returnBody} to "{""method"":""GET""}"

if {_method} is "PATCH":
reply {_request} with body "{""method"":""PATCH""}" and response code 200
exit
set {_returnBody} to "{""method"":""PATCH""}"

if {_method} is "POST":
reply {_request} with body "{""method"":""POST""}" and response code 200
exit
set {_returnBody} to "{""method"":""POST""}"

if {_method} is "PUT":
reply {_request} with body "{""method"":""PUT""}" and response code 200
exit


# This will reply 500 without no body
reply {_request}
set {_returnBody} to "{""method"":""PUT""}"

broadcast "RETURN BODY: %{_returnBody}%"
if {_returnBody} is not "":
reply {_request} with body {_returnBody} and response code 200
else:
# This will reply 500 without body
reply {_request}


command testreq <string> <string>:
Expand Down

0 comments on commit e530599

Please sign in to comment.