-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpRequest.java
More file actions
49 lines (40 loc) · 1.04 KB
/
HttpRequest.java
File metadata and controls
49 lines (40 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Map;
/**
* Represents an HTTP request
*/
public class HttpRequest {
private final String method;
private final String path;
private final String version;
private final Map<String, String> headers;
private final String body;
public HttpRequest(String method, String path, String version, Map<String, String> headers, String body) {
this.method = method;
this.path = path;
this.version = version;
this.headers = headers;
this.body = body;
}
public String getMethod() {
return method;
}
public String getPath() {
return path;
}
public String getVersion() {
return version;
}
public Map<String, String> getHeaders() {
return headers;
}
public String getHeader(String name) {
return headers.get(name);
}
public String getBody() {
return body;
}
@Override
public String toString() {
return method + " " + path + " " + version;
}
}