Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
hybrid-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DAI 23-24
hybrid-server
Commits
0ea6b4b4
Commit
0ea6b4b4
authored
Sep 22, 2023
by
Miguel Reboiro Jato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves format of HTTPRequest tests
The request has been reformated for a better readibility.
parent
b8696138
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
22 deletions
+50
-22
HTTPBadRequestsTest.java
...vigo/esei/dai/hybridserver/week1/HTTPBadRequestsTest.java
+24
-9
HTTPRequestGETParametersTest.java
.../dai/hybridserver/week1/HTTPRequestGETParametersTest.java
+4
-2
HTTPRequestGETResourceTest.java
...ei/dai/hybridserver/week1/HTTPRequestGETResourceTest.java
+2
-1
HTTPRequestGETResourcesTest.java
...i/dai/hybridserver/week1/HTTPRequestGETResourcesTest.java
+2
-1
HTTPRequestGETRootTest.java
...o/esei/dai/hybridserver/week1/HTTPRequestGETRootTest.java
+2
-1
HTTPRequestPOSTEncodedTest.java
...ei/dai/hybridserver/week1/HTTPRequestPOSTEncodedTest.java
+8
-4
HTTPRequestPOSTMultipleParametersTest.java
...idserver/week1/HTTPRequestPOSTMultipleParametersTest.java
+4
-2
HTTPRequestPOSTOneParameterTest.java
...i/hybridserver/week1/HTTPRequestPOSTOneParameterTest.java
+4
-2
No files found.
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPBadRequestsTest.java
View file @
0ea6b4b4
...
@@ -40,39 +40,54 @@ public class HTTPBadRequestsTest {
...
@@ -40,39 +40,54 @@ public class HTTPBadRequestsTest {
arguments
(
arguments
(
named
(
named
(
"Missing method"
,
"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"
+
"Accept-Encoding: gzip,deflate\r\n"
)
)
),
),
arguments
(
arguments
(
named
(
named
(
"Missing resource"
,
"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
(
arguments
(
named
(
named
(
"Missing version"
,
"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
(
arguments
(
named
(
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
(
arguments
(
named
(
named
(
"Invalid header"
,
"Invalid header"
,
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
+
"Host\r\n"
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
+
"Host\r\n"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
)
)
),
),
arguments
(
arguments
(
named
(
named
(
"Missing new line after header"
,
"Missing new line after header"
,
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1"
+
"Host: localhost\r\n"
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
+
"Host: localhost\r\n"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
)
)
)
)
);
);
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestGETParametersTest.java
View file @
0ea6b4b4
...
@@ -26,8 +26,10 @@ public class HTTPRequestGETParametersTest {
...
@@ -26,8 +26,10 @@ public class HTTPRequestGETParametersTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
requestText
=
"GET /hello/world.html?country=Spain&province=Ourense&city=Ourense HTTP/1.1\r\n"
requestText
=
+
"Host: localhost\r\n"
+
"Accept: text/html\r\n"
"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"
;
+
"Accept-Encoding: gzip,deflate\r\n"
;
request
=
new
HTTPRequest
(
new
StringReader
(
requestText
+
"\r\n"
));
request
=
new
HTTPRequest
(
new
StringReader
(
requestText
+
"\r\n"
));
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestGETResourceTest.java
View file @
0ea6b4b4
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETResourceTest {
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETResourceTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
+
"Host: localhost\r\n"
+
"Accept: text/html\r\n"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
;
+
"Accept-Encoding: gzip,deflate\r\n"
;
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestGETResourcesTest.java
View file @
0ea6b4b4
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETResourcesTest {
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETResourcesTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
+
"Host: localhost\r\n"
+
"Accept: text/html\r\n"
+
"Accept: text/html\r\n"
+
"Accept-Encoding: gzip,deflate\r\n"
;
+
"Accept-Encoding: gzip,deflate\r\n"
;
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestGETRootTest.java
View file @
0ea6b4b4
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETRootTest {
...
@@ -27,7 +27,8 @@ public class HTTPRequestGETRootTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
;
+
"Host: localhost\r\n"
;
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
+
"\r\n"
));
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
+
"\r\n"
));
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestPOSTEncodedTest.java
View file @
0ea6b4b4
...
@@ -27,16 +27,20 @@ public class HTTPRequestPOSTEncodedTest {
...
@@ -27,16 +27,20 @@ public class HTTPRequestPOSTEncodedTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
+
"Host: localhost\r\n"
+
"Content-Type: application/x-www-form-urlencoded\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!!"
;
+
"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"
+
"Host: localhost\r\n"
+
"Content-Type: application/x-www-form-urlencoded\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"
;
+
"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
));
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
encodedRequestText
));
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestPOSTMultipleParametersTest.java
View file @
0ea6b4b4
...
@@ -25,9 +25,11 @@ public class HTTPRequestPOSTMultipleParametersTest {
...
@@ -25,9 +25,11 @@ public class HTTPRequestPOSTMultipleParametersTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
+
"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!!"
;
+
"message=Hello world!!&mensaje=¡¡Hola mundo!!&mensaxe=Ola mundo!!&mensagem=Olá mundo!!"
;
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
));
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
));
...
...
src/test/java/es/uvigo/esei/dai/hybridserver/week1/HTTPRequestPOSTOneParameterTest.java
View file @
0ea6b4b4
...
@@ -26,9 +26,11 @@ public class HTTPRequestPOSTOneParameterTest {
...
@@ -26,9 +26,11 @@ public class HTTPRequestPOSTOneParameterTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
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"
+
"Host: localhost\r\n"
+
"Content-Length: 21\r\n\r\n"
+
"Content-Length: 21\r\n"
+
"\r\n"
+
"message=Hello world!!"
;
+
"message=Hello world!!"
;
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
));
this
.
request
=
new
HTTPRequest
(
new
StringReader
(
this
.
requestText
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment