Skip to content

Commit 4a95c8f

Browse files
4lisalehivishr
authored andcommitted
Update cookies.md (#101)
* Update cookies.md * Update cookies.md #2
1 parent 3132611 commit 4a95c8f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

website/content/guide/cookies.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ description = "Handling cookie in Echo"
66
parent = "guide"
77
+++
88

9-
Cookie is a small piece of data sent from a website and stored in the user's web
10-
browser while the user is browsing. Every time the user loads the website, the browser
11-
sends the cookie back to the server to notify the user's previous activity.
9+
Cookie is a small piece of data sent from a website server and stored in the user's web
10+
browser while browsing. Every time the user loads the website, the browser
11+
sends the cookies back to the server to notify the server of user's latest activity.
1212
Cookies were designed to be a reliable mechanism for websites to remember stateful
13-
information (such as items added in the shopping cart in an online store) or to
14-
record the user's browsing activity (including clicking particular buttons, logging
15-
in, or recording which pages were visited in the past). Cookies can also store
16-
passwords and form content a user has previously entered, such as a credit card
17-
number or an address.
13+
information (e.g. items added to the shopping cart in an online store) or to
14+
record the user's browsing activity (such as clicking particular buttons, logging
15+
in, or user previously visited pages of the website). Cookies can also store form content a user has previously entered, such as username, gender, age, address, etc.
1816

1917
## Cookie Attributes
2018

@@ -45,7 +43,7 @@ func writeCookie(c echo.Context) error {
4543

4644
- Cookie is created using `new(http.Cookie)`.
4745
- Attributes for the cookie are set assigning to the `http.Cookie` instance public attributes.
48-
- Finally `c.SetCookie(cookies)` adds a `Set-Cookie` header in HTTP response.
46+
- Finally `c.SetCookie(cookie)` adds a `Set-Cookie` header in HTTP response.
4947

5048
## Read a Cookie
5149

@@ -64,14 +62,14 @@ func readCookie(c echo.Context) error {
6462
- Cookie is read by name using `c.Cookie("username")` from the HTTP request.
6563
- Cookie attributes are accessed using `Getter` function.
6664

67-
## Read all Cookies
65+
## Read all the Cookies
6866

6967
```go
7068
func readAllCookies(c echo.Context) error {
7169
for _, cookie := range c.Cookies() {
7270
fmt.Println(cookie.Name)
7371
fmt.Println(cookie.Value)
7472
}
75-
return c.String(http.StatusOK, "read all cookie")
73+
return c.String(http.StatusOK, "read all the cookies")
7674
}
7775
```

0 commit comments

Comments
 (0)