Skip to content

Commit e3c2806

Browse files
committed
add a body to the error message
1 parent 7a8c6dc commit e3c2806

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

HttpResponse.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ else if (line.toLowerCase(Locale.ROOT).startsWith("last-modified")) {
114114

115115
// constructor for HTTP status codes
116116
public HttpResponse(int statusCode) {
117-
this.version = "HTTP/1.1";
118-
this.status = statusCode;
117+
version = "HTTP/1.1";
118+
status = statusCode;
119119

120120
switch (status) {
121121
case 200:
@@ -150,7 +150,9 @@ public HttpResponse(int statusCode) {
150150
status = 500;
151151
statusMessage = "Internal server error";
152152
}
153-
this.statusLine = this.version + " " + this.status + " " + this.statusMessage;
153+
statusLine = version + " " + status + " " + statusMessage;
154+
String bodyStr = status + " " + statusMessage;
155+
body.write(bodyStr.getBytes(), 0, bodyStr.length());
154156
}
155157

156158
public HttpResponse setStaus(int status) {

0 commit comments

Comments
 (0)