HttpRequest
classin packageklyn.net
public class HttpRequest extends Object:
Immutable HTTP request description.
`HttpRequest` carries the URL, method, headers and optional body to be sent
by `HttpClient`.
import klyn.net
request = HttpRequest("https://example.com/api", "POST").withBody({"name": "klyn"})
print(request.method)
Fields
| Modifier and Type |
Member |
Description |
| public |
HttpRequest(url |
Creates an immutable HTTP request. |
Properties
| Modifier and Type |
Member |
Description |
| public readonly property |
body |
Optional request body. |
| public readonly property |
headers |
Request headers copied at construction time. |
| public readonly property |
method |
Normalized HTTP method. |
| public readonly property |
url |
Target HTTP or HTTPS URL. |
Methods
| Modifier and Type |
Member |
Description |
| public override |
toString |
No summary. |
| public |
withBody |
Returns a copy with a different request body. |
| public |
withHeader |
Returns a copy with one header added or replaced. |
| public |
withMethod |
Returns a copy with a different HTTP method. |
| public |
withoutHeader |
Returns a copy without one header. |