KirillBelov/ HTTPHandler

(1.0.11) current version: 1.0.12 »

HTTP Handler

Contributed by: Kirill Belov

HTTP Handler

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["KirillBelov/HTTPHandler"]

Details

Handling HTTP Requests

Examples

Basic Examples

Create handler:

In[1]:=
http = HTTPHandler[]
Out[1]=

Example request:

In[2]:=
request = StringToByteArray[
  "GET /point?x=1&y=2 HTTP/1.1\r\nConnection: keep-alive\r\n\r\n"]
Out[2]=

Fake socket:

In[3]:=
socket = CSocket["fake_socket"]
Out[3]=

Handler pair socket + request:

In[4]:=
http[socket, request]
Out[4]=

Add handler:

In[5]:=
http["Handler", "Point"] = AssocMatchQ[<|"Path" -> "/point"|>] -> Function[StringTemplate["(x = `x`, y = `y`)"][#Query]]
Out[5]=

Try it:

In[6]:=
http[socket, request]
Out[6]=

Publisher

Kirill Belov

Disclosures

Compatibility

Wolfram Language Version 13

Version History

License Information

MIT License

Paclet Source

Source Metadata

See Also