Skip to content

Commit

Permalink
better 204 & 304 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
larrytheliquid committed Sep 5, 2010
1 parent 5d2631b commit f9d626b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Lemmachine/Format/Request.agda
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ POST-Format =
Required-Header Content-Type >>-
Optional-Header Expires >>-
f (proj₁ c-l) (proj₁ (proj₂ c-l))

where

f : (s : Single Content-Length) Header-Value (proj s) Format
f (single ._) n = Headers-End >> Base (STR n)

Expand Down
11 changes: 9 additions & 2 deletions src/Lemmachine/Format/Response.agda
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ WWW-Authenticate-Format 401-Unauthorized = Required-Header WWW-Authenticate
WWW-Authenticate-Format _ = End

Remaining-Format : Format Method Code Format
Remaining-Format x _ 204-No-Content = x >>- Headers-End >> End
Remaining-Format x _ 304-Not-Modified = x >>- Headers-End >> End
Remaining-Format x _ 304-Not-Modified =
Optional-Header Allow >>-
Optional-Header Expires >>-
x >>-
Headers-End >>
End
Remaining-Format x m c =
Optional-Header Allow >>-
Optional-Header Content-Encoding >>-
Expand All @@ -39,8 +43,11 @@ Remaining-Format x m c =
x >>-
Headers-End >>
f m c (proj₁ c-l) (proj₁ (proj₂ c-l))

where

f : Method Code (s : Single Content-Length) Header-Value (proj s) Format
f _ 204-No-Content _ _ = End
f HEAD _ _ _ = End
f _ 201-Created (single ._) zero = Fail
f _ 202-Accepted (single ._) zero = Fail
Expand Down

0 comments on commit f9d626b

Please sign in to comment.