atomized 1.0.0
An HTTP request/response builder/parser.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
atomizes
A port of Maxwell Flynn's HTTP request/response builder/parser atomizes.
Usage
Simply add atomized to your project's dub dependencies. For example:
"dependencies": {
"atomized": "~>1.0.0"
}
Including
All that's necessary to include the library is this:
import atomized;
Examples
Responses
HTTPMessage response = new HTTPMessage;
response.setStatusCode(200)
.setHeader("Content-Type", "text/plain")
.setHeader("Connection", "close")
.setMessageBody("Hello world!");
writeln(response);
This results in the following output:
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: close
Content-Length: 12
Hello world!
Requests
HTTPMessage request = new HTTPMessage;
request.setMethod(MessageMethod.GET)
.setPath("/")
.setHeader("Host", "example.com")
.setHeader("User-Agent", "Test Agent")
.setHeader("Connection", "keep-alive");
writeln(request);
This results in the following output:
GET / HTTP/1.1
User-Agent: Test Agent
Host: example.com
Connection: keep-alive
Parser
string requestString = "GET / HTTP/1.1\r\nHost: example.com\r\nUser-Agent: Test Agent\r\nConnection: keep-alive\r\n\r\n";
HTTPMessage request = new HTTPMessage;
HTTPMessageParser parser = new HTTPMessageParser;
parser.parse(request, requestString);
writeln(request);
This results in the following output:
GET / HTTP/1.1
User-Agent: Test Agent
Host: example.com
Connection: keep-alive
License
atomize(s/d) is licensed under the MIT license.
- Registered by Jordan Fitzgerald
- 1.0.0 released 6 years ago
- JordanFitz/atomized
- github.com/tinfoilboy/atomizes
- MIT
- Copyright © 2018 Maxwell Flynn
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.0 2018-Dec-14 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
10 downloads total
-
- Score:
- 0.7
- Short URL:
- atomized.dub.pm