HttpRequest class

HTTP-like request

Constructors

HttpRequest.new({required HttpMethod method, required String path, String version = 'HTTP/1.1', Map<String, String>? headers, Uint8List? body, required PeerId remotePeer})

Properties

body Uint8List?
final
bodyAsJson Map<String, dynamic>?
Get body as JSON
no setter
bodyAsString String?
Get body as string (assumes UTF-8 encoding)
no setter
contentLength int
Get content length from headers or body
no setter
contentType String
Get content type from headers
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
final
method HttpMethod
final
path String
final
remotePeer PeerId
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version String
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize() Uint8List
Serialize request to wire format
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

parse(Uint8List data, PeerId remotePeer) HttpRequest
Parse request from wire format