Compare commits

..

No commits in common. "main" and "v1.7.0" have entirely different histories.
main ... v1.7.0

2 changed files with 1 additions and 19 deletions

View File

@ -22,7 +22,6 @@ struct ServerHttpRequestBuilder {
string[][string] headers;
QueryParameter[] queryParams;
InputStream!ubyte inputStream = inputStreamObjectFor(NoOpInputStream!ubyte());
Object[string] contextData;
ref withVersion(HttpVersion httpVersion) {
this.httpVersion = httpVersion;
@ -76,11 +75,6 @@ struct ServerHttpRequestBuilder {
return withBody(cast(ubyte[]) bodyStr);
}
ref withContextData(string key, Object obj) {
this.contextData[key] = obj;
return this;
}
ServerHttpRequest build() {
return ServerHttpRequest(
httpVersion,
@ -89,20 +83,12 @@ struct ServerHttpRequestBuilder {
url,
headers,
queryParams,
inputStream,
contextData
inputStream
);
}
}
unittest {
class SampleContextData {
string name;
this(string name) {
this.name = name;
}
}
ServerHttpRequest r1 = ServerHttpRequestBuilder()
.withUrl("/test-url")
.withVersion(HttpVersion.V2)
@ -112,7 +98,6 @@ unittest {
.withHeader("Content-Type", "text/plain")
.withHeader("Content-Length", "12")
.withQueryParam("idx", "42")
.withContextData("name", new SampleContextData("andrew"))
.build();
assert(r1.httpVersion == HttpVersion.V2);
assert(r1.url == "/test-url");
@ -124,7 +109,6 @@ unittest {
assert(r1.getHeaderAs!string("Content-Type") == "text/plain");
assert(r1.getHeaderAs!ulong("Content-Length") == 12);
assert(r1.getParamAs!ulong("idx") == 42);
assert((cast(SampleContextData) r1.contextData["name"]).name == "andrew");
}
/**

View File

@ -29,8 +29,6 @@ struct ServerHttpRequest {
const QueryParameter[] queryParams;
/// The underlying stream used to read the body from the request.
InputStream!ubyte inputStream;
/// Any additional data about this request that may be populated during handling.
Object[string] contextData;
/**
* Gets a header as the specified type, or returns the default value if the