Commit 0ea6b4b4 authored by Miguel Reboiro Jato's avatar Miguel Reboiro Jato

Improves format of HTTPRequest tests

The request has been reformated for a better readibility.
parent b8696138
......@@ -40,39 +40,54 @@ public class HTTPBadRequestsTest {
arguments(
named(
"Missing method",
"/hello HTTP/1.1\r\n" + "Host: localhost\r\n" + "Accept: text/html\r\n"
"/hello HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
),
arguments(
named(
"Missing resource",
"GET HTTP/1.1\r\n" + "Host: localhost\r\n" + "Accept: text/html\r\n" + "Accept-Encoding: gzip,deflate\r\n"
"GET HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
),
arguments(
named(
"Missing version",
"GET /hello\r\n" + "Host: localhost\r\n" + "Accept: text/html\r\n" + "Accept-Encoding: gzip,deflate\r\n"
"GET /hello\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
),
arguments(
named(
"Missing first line", "Host: localhost\r\n" + "Accept: text/html\r\n" + "Accept-Encoding: gzip,deflate\r\n"
"Missing first line",
"Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
),
arguments(
named(
"Invalid header",
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n" + "Host\r\n"
+ "Accept: text/html\r\n" + "Accept-Encoding: gzip,deflate\r\n"
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
+ "Host\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
),
arguments(
named(
"Missing new line after header",
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1" + "Host: localhost\r\n"
+ "Accept: text/html\r\n" + "Accept-Encoding: gzip,deflate\r\n"
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
)
)
);
......
......@@ -26,8 +26,10 @@ public class HTTPRequestGETParametersTest {
@BeforeEach
public void setUp() throws Exception {
requestText = "GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
+ "Host: localhost\r\n" + "Accept: text/html\r\n"
requestText =
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n";
request = new HTTPRequest(new StringReader(requestText + "\r\n"));
......
......@@ -27,7 +27,8 @@ public class HTTPRequestGETResourceTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "GET /hello HTTP/1.1\r\n"
this.requestText =
"GET /hello HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n";
......
......@@ -27,7 +27,8 @@ public class HTTPRequestGETResourcesTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "GET /hello/world.html HTTP/1.1\r\n"
this.requestText =
"GET /hello/world.html HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Accept: text/html\r\n"
+ "Accept-Encoding: gzip,deflate\r\n";
......
......@@ -27,7 +27,8 @@ public class HTTPRequestGETRootTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "GET / HTTP/1.1\r\n"
this.requestText =
"GET / HTTP/1.1\r\n"
+ "Host: localhost\r\n";
this.request = new HTTPRequest(new StringReader(this.requestText + "\r\n"));
......
......@@ -27,16 +27,20 @@ public class HTTPRequestPOSTEncodedTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "POST / HTTP/1.1\r\n"
this.requestText =
"POST / HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 116\r\n\r\n"
+ "Content-Length: 116\r\n"
+ "\r\n"
+ "message=Hello world!!&mensaje=¡¡Hola mundo!!&mensaxe=Ola mundo!!&mensagem=Olá mundo!!";
this.encodedRequestText = "POST / HTTP/1.1\r\n"
this.encodedRequestText =
"POST / HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 116\r\n\r\n"
+ "Content-Length: 116\r\n"
+ "\r\n"
+ "message=Hello+world%21%21&mensaje=%C2%A1%C2%A1Hola+mundo%21%21&mensaxe=Ola+mundo%21%21&mensagem=Ol%C3%A1+mundo%21%21";
this.request = new HTTPRequest(new StringReader(this.encodedRequestText));
......
......@@ -25,9 +25,11 @@ public class HTTPRequestPOSTMultipleParametersTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "POST /resource HTTP/1.1\r\n"
this.requestText =
"POST /resource HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Content-Length: 85\r\n\r\n"
+ "Content-Length: 85\r\n"
+ "\r\n"
+ "message=Hello world!!&mensaje=¡¡Hola mundo!!&mensaxe=Ola mundo!!&mensagem=Olá mundo!!";
this.request = new HTTPRequest(new StringReader(this.requestText));
......
......@@ -26,9 +26,11 @@ public class HTTPRequestPOSTOneParameterTest {
@BeforeEach
public void setUp() throws Exception {
this.requestText = "POST / HTTP/1.1\r\n"
this.requestText =
"POST / HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Content-Length: 21\r\n\r\n"
+ "Content-Length: 21\r\n"
+ "\r\n"
+ "message=Hello world!!";
this.request = new HTTPRequest(new StringReader(this.requestText));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment