Skip to content

Commit 45059bb

Browse files
authored
Merge release pull request
2 parents a17a989 + 2a79d04 commit 45059bb

File tree

2 files changed

+104
-105
lines changed

2 files changed

+104
-105
lines changed

README.md

Lines changed: 103 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -76,109 +76,8 @@ NetworkAuthenticationRequired or 511
7676
```
7777
Any other value will resolve to 200 (OK)
7878

79-
# Examples
80-
### Simple request returning nothing in the response's body:
81-
```
82-
curl -w '\n' -v http://localhost:8080
83-
```
84-
```sh
85-
* Trying ::1...
86-
* TCP_NODELAY set
87-
* Connected to localhost (::1) port 8080 (#0)
88-
> GET / HTTP/1.1
89-
> Host: localhost:8080
90-
> User-Agent: curl/7.64.1
91-
> Accept: */*
92-
>
93-
< HTTP/1.1 200 OK
94-
< Content-Encoding: identity
95-
< Content-Type: text/plain
96-
< Date: Tue, 29 Dec 2020 18:35:48 GMT
97-
< Content-Length: 0
98-
<
99-
* Connection #0 to host localhost left intact
100-
101-
* Closing connection 0
102-
```
103-
104-
### Request returning _Hello World_ in the response's body:
105-
```
106-
curl -w '\n' -v -H "X-Erised-Data:Hello World" http://localhost:8080
107-
```
108-
```sh
109-
* Trying ::1...
110-
* TCP_NODELAY set
111-
* Connected to localhost (::1) port 8080 (#0)
112-
> GET / HTTP/1.1
113-
> Host: localhost:8080
114-
> User-Agent: curl/7.64.1
115-
> Accept: */*
116-
> X-Erised-Data:Hello World
117-
>
118-
< HTTP/1.1 200 OK
119-
< Content-Encoding: identity
120-
< Content-Type: text/plain
121-
< Date: Tue, 29 Dec 2020 18:38:10 GMT
122-
< Content-Length: 11
123-
<
124-
* Connection #0 to host localhost left intact
125-
Hello World
126-
* Closing connection 0
127-
```
128-
129-
### Request returning _[{"Hello":"World"}]_ in the response's body and _json_ in the header's Content-Type
130-
```
131-
curl -w '\n' -v -H "X-Erised-Content-Type:json" -H "X-Erised-Data:[{\"Hello\":\"World\"}]" http://localhost:8080
132-
```
133-
```sh
134-
* Trying ::1...
135-
* TCP_NODELAY set
136-
* Connected to localhost (::1) port 8080 (#0)
137-
> GET / HTTP/1.1
138-
> Host: localhost:8080
139-
> User-Agent: curl/7.64.1
140-
> Accept: */*
141-
> X-Erised-Content-Type:json
142-
> X-Erised-Data:[{Hello:World}]
143-
>
144-
< HTTP/1.1 200 OK
145-
< Content-Encoding: identity
146-
< Content-Type: application/json
147-
< Date: Tue, 29 Dec 2020 18:43:55 GMT
148-
< Content-Length: 15
149-
<
150-
* Connection #0 to host localhost left intact
151-
[{"Hello":"World"}]
152-
* Closing connection 0
153-
```
154-
155-
### Request returning _text_ in the response body and [_418 I'm a teapot_](https://save418.com/) in the header's Status Code
156-
```
157-
curl -w '\n' -v -H "X-Erised-Status-Code:Teapot" -H "X-Erised-Data:Server refuses to brew coffee because it is, permanently, a teapot." http://localhost:8080
158-
```
159-
```sh
160-
* Trying ::1...
161-
* TCP_NODELAY set
162-
* Connected to localhost (::1) port 8080 (#0)
163-
> GET / HTTP/1.1
164-
> Host: localhost:8080
165-
> User-Agent: curl/7.64.1
166-
> Accept: */*
167-
> X-Erised-Status-Code:Teapot
168-
> X-Erised-Data:Server refuses to brew coffee because it is, permanently, a teapot.
169-
>
170-
< HTTP/1.1 418 I'm a teapot
171-
< Content-Encoding: identity
172-
< Content-Type: text/plain
173-
< Date: Tue, 29 Dec 2020 18:54:46 GMT
174-
< Content-Length: 67
175-
<
176-
* Connection #0 to host localhost left intact
177-
Server refuses to brew coffee because it is, permanently, a teapot.
178-
* Closing connection 0
179-
```
180-
18179
# Release History
80+
* v0.2.1 - Add gzip compression, improve erised/headers json handling
18281
* v0.0.3 - Add erised/headers, erised/ip and erised/info paths. Add delayed responses
18382
* v0.0.2 - Add HTTP redirection status codes (300's), startup configuration parameters and request's logging
18483
* v0.0.1 - Initial release
@@ -188,8 +87,6 @@ Server refuses to brew coffee because it is, permanently, a teapot.
18887

18988
Of all its deficiencies, the most notable are:
19089
* There are not tests (yet)
191-
* ~~**erised** offers no help~~
192-
* ~~Server parameters are hardcoded~~
19390
* Server does not shutdown gracefully. To stop, process must be terminated
19491
* https protocol is not supported
19592
* **erised** does not scale well
@@ -287,3 +184,105 @@ http://localhost:8080/jokes/random
287184
{"timestamp":"2020-12-30T11:21:32.793Z","status":404,"error":"Not Found","message":"Chuck Norris knows everything there is to know - Except where this page is.","path":"/jokes/random"}
288185
* Closing connection 0
289186
```
187+
188+
# Examples
189+
### Simple request returning nothing in the response's body:
190+
```
191+
curl -w '\n' -v http://localhost:8080
192+
```
193+
```sh
194+
* Trying ::1...
195+
* TCP_NODELAY set
196+
* Connected to localhost (::1) port 8080 (#0)
197+
> GET / HTTP/1.1
198+
> Host: localhost:8080
199+
> User-Agent: curl/7.64.1
200+
> Accept: */*
201+
>
202+
< HTTP/1.1 200 OK
203+
< Content-Encoding: identity
204+
< Content-Type: text/plain
205+
< Date: Tue, 29 Dec 2020 18:35:48 GMT
206+
< Content-Length: 0
207+
<
208+
* Connection #0 to host localhost left intact
209+
210+
* Closing connection 0
211+
```
212+
213+
### Request returning _Hello World_ in the response's body:
214+
```
215+
curl -w '\n' -v -H "X-Erised-Data:Hello World" http://localhost:8080
216+
```
217+
```sh
218+
* Trying ::1...
219+
* TCP_NODELAY set
220+
* Connected to localhost (::1) port 8080 (#0)
221+
> GET / HTTP/1.1
222+
> Host: localhost:8080
223+
> User-Agent: curl/7.64.1
224+
> Accept: */*
225+
> X-Erised-Data:Hello World
226+
>
227+
< HTTP/1.1 200 OK
228+
< Content-Encoding: identity
229+
< Content-Type: text/plain
230+
< Date: Tue, 29 Dec 2020 18:38:10 GMT
231+
< Content-Length: 11
232+
<
233+
* Connection #0 to host localhost left intact
234+
Hello World
235+
* Closing connection 0
236+
```
237+
238+
### Request returning _[{"Hello":"World"}]_ in the response's body and _json_ in the header's Content-Type
239+
```
240+
curl -w '\n' -v -H "X-Erised-Content-Type:json" -H "X-Erised-Data:[{\"Hello\":\"World\"}]" http://localhost:8080
241+
```
242+
```sh
243+
* Trying ::1...
244+
* TCP_NODELAY set
245+
* Connected to localhost (::1) port 8080 (#0)
246+
> GET / HTTP/1.1
247+
> Host: localhost:8080
248+
> User-Agent: curl/7.64.1
249+
> Accept: */*
250+
> X-Erised-Content-Type:json
251+
> X-Erised-Data:[{Hello:World}]
252+
>
253+
< HTTP/1.1 200 OK
254+
< Content-Encoding: identity
255+
< Content-Type: application/json
256+
< Date: Tue, 29 Dec 2020 18:43:55 GMT
257+
< Content-Length: 15
258+
<
259+
* Connection #0 to host localhost left intact
260+
[{"Hello":"World"}]
261+
* Closing connection 0
262+
```
263+
264+
### Request returning _text_ in the response body and [_418 I'm a teapot_](https://save418.com/) in the header's Status Code
265+
```
266+
curl -w '\n' -v -H "X-Erised-Status-Code:Teapot" -H "X-Erised-Data:Server refuses to brew coffee because it is, permanently, a teapot." http://localhost:8080
267+
```
268+
```sh
269+
* Trying ::1...
270+
* TCP_NODELAY set
271+
* Connected to localhost (::1) port 8080 (#0)
272+
> GET / HTTP/1.1
273+
> Host: localhost:8080
274+
> User-Agent: curl/7.64.1
275+
> Accept: */*
276+
> X-Erised-Status-Code:Teapot
277+
> X-Erised-Data:Server refuses to brew coffee because it is, permanently, a teapot.
278+
>
279+
< HTTP/1.1 418 I'm a teapot
280+
< Content-Encoding: identity
281+
< Content-Type: text/plain
282+
< Date: Tue, 29 Dec 2020 18:54:46 GMT
283+
< Content-Length: 67
284+
<
285+
* Connection #0 to host localhost left intact
286+
Server refuses to brew coffee because it is, permanently, a teapot.
287+
* Closing connection 0
288+
```

cmd/erised/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010
)
1111

12-
const version = "v0.0.3"
12+
const version = "v0.2.1"
1313

1414
type server struct {
1515
mux *http.ServeMux

0 commit comments

Comments
 (0)