Skip to content

Commit cff6528

Browse files
committed
Add cookie example Hurl workflow
1 parent 613467c commit cff6528

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
services:
22
web:
3-
build: .
3+
image: lovasoa/sqlpage:main
44
ports:
55
- "8080:8080"
6+
volumes:
7+
- .:/var/www
8+
- ./sqlpage:/etc/sqlpage
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
-- Sets the username cookie to the value of the username parameter
22
SELECT 'cookie' as component,
33
'username' as name,
4-
$username as value
5-
WHERE $username IS NOT NULL;
4+
:username as value
5+
WHERE :username IS NOT NULL;
66

77
SELECT 'form' as component;
88
SELECT 'username' as name,
99
'User Name' as label,
10-
COALESCE($username, sqlpage.cookie('username')) as value,
10+
COALESCE(:username, sqlpage.cookie('username')) as value,
1111
'try leaving this page and coming back, the value should be saved in a cookie' as description;
1212

1313
select 'text' as component;
1414
select 'log out' as contents, 'logout.sql' as link;
1515

1616
select 'text' as component;
17-
select 'View the cookie from a subdirectory' as contents, 'subdirectory/read_cookies.sql' as link;
17+
select 'View the cookie from a subdirectory' as contents, 'subdirectory/read_cookies.sql' as link;

examples/read-and-set-http-cookies/test.hurl

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
GET http://localhost:8080/
2+
HTTP 200
3+
[Asserts]
4+
body contains "User Name"
5+
body contains "View the cookie from a subdirectory"
6+
body not contains "An error occurred"
7+
8+
POST http://localhost:8080/
9+
[FormParams]
10+
username: Hurl Cookie
11+
HTTP 200
12+
[Asserts]
13+
header "Set-Cookie" contains "username=Hurl%20Cookie"
14+
body contains "Hurl Cookie"
15+
body not contains "An error occurred"
16+
17+
GET http://localhost:8080/
18+
HTTP 200
19+
[Asserts]
20+
body contains "Hurl Cookie"
21+
body not contains "An error occurred"
22+
23+
GET http://localhost:8080/subdirectory/read_cookies.sql
24+
HTTP 200
25+
[Asserts]
26+
body contains "The value of your username cookie was: Hurl Cookie"
27+
body contains "It has now been removed"
28+
body not contains "An error occurred"
29+
30+
GET http://localhost:8080/
31+
HTTP 200
32+
[Asserts]
33+
body not contains "Hurl Cookie"
34+
body not contains "An error occurred"

0 commit comments

Comments
 (0)