Commit Graph

39 Commits

Author SHA1 Message Date
Tim McIver
b3eb977096
Fix HTTPure.Utils.replacePlus (#166)
* Create failing test.

* Fix code so failing test passes.
2020-11-14 13:09:07 -08:00
Drew Olson
ac43b0d125 Update response functions to return MonadAff m => m Response (#150)
* Update Response functions to return MonadAffs

* Install psc-package for travis build
2019-09-29 20:57:15 -07:00
Gareth Smith
d37096dcce Add some type declarations to get compatibility with node-buffer 6.x. (#149)
Since node-buffer 6.x is not yet in the package set, compatibility with
node-buffer 5.x is maintained.
2019-09-24 17:09:29 -07:00
Gareth Smith
4d5518eff5 Update the tests to work with purescript-spec v4.0.0 (#147)
This version was already being pulled in by the package set, so the
tests were breaking.

Also update bower.json to match the package set dependencies.
2019-09-23 13:14:21 -07:00
Hardy Jones
5d7c2c8bda Use CaseInsensitiveString for Headers (#138)
* v0.8.1

* Add failing tests for `Headers`

There's currently a bug with `Headers`:
if a header is created with uppercase characters, it can never be found.
The problem is that we only look for lowercase characters in the
`Lookup` instance for `Headers`.

* Convert `Headers` to use `CaseInsensitiveString`

In an effort to be more true to HTTP,
we make the header keys case-insensitive.
This fixes the issue of looking up a header where the casing is different,
Since `CaseInsensitiveString`s compare in a way that ignore casing.

The API for consumers for `Headers` stays the same,
but we get more correct code.
A win for all!
2019-04-25 20:06:15 -07:00
Hardy Jones
c208dffb7b Add HTTP version (#137)
* v0.8.1

* Add the HTTP version to `Request`

The `node-http` `Request` has the HTTP version on it.
We can make it available in our `Request` for consumers.

We went the naive approach first and typed it as a string.
There is some structure to the version,
so we could attempt to parse it.
It's unclear what we would do if parsing failed though.

Maybe we want something like:
```PureScript
data Version
  = Known { major :: Int, minor :: Int }
  | Unknown String
```

That would allow us to parse the known format,
and fallback to accepting anything else.
It's definitely something to discuss anyway.

* Make HTTP version its own data type

There are only a handful of HTTP versions that are commonly used.
We can talk about those explicitly and fallback to any arbitrary version.

The changes here try to follow the patterns elsewhere in the code base.
Hopefully, it's not too far off.
2019-04-25 10:13:04 -07:00
Petri Lehtinen
98b0b4e268 Query param fixes (#128)
* Represent emtpy query parameters as empty strings instead of "true"

* Encode and decode query params

Fixes #126

* Pass invalid query parameters through instead of ignoring them

* Decode the plus sign `+` as a space ` ` in query string

* Decode percent encoding in path segments

* Update History.md
2018-11-06 09:45:37 -08:00
Petri Lehtinen
d333c6f6b3 Respond with 500 Internal Server Error upon unhandled exceptions (#123)
Refs #109
2018-10-09 10:37:23 -07:00
Connor Prussin
ce4a10a3b5
Make server cancelable and clean up examples and tests (#112) 2018-09-02 14:05:54 -07:00
Connor Prussin
1adbcecaaa
Chunked responses (#107)
* Chunked responses

* Remove Chunked newtype wrapper around Streams

* Use child process instead of ffi stream for chunked example

* Rename additionalHeaders to defaultHeaders

* Add History.md entry

* General cleanup
2018-08-30 15:01:49 -07:00
Connor Prussin
1bde8b4b1d
Consolidate APIs (#104)
* Consolidate APIs

* Use partial function approach instead of Streamable typeclass

* Clean up
2018-08-26 21:54:04 -07:00
Petri Lehtinen
2673bd4b0b
Fix Content-Length for non-ASCII response bodies (#103)
Fixes #101
2018-08-25 07:49:28 +03:00
Petri Lehtinen
3e94aa6f9d Support binary response body (#99)
* Support binary response body

Fixes #98

* Address PR comments

- Expose data constructors for Body and use them for construction and
  pattern matching instead of various helpers

- Add an example and integration test for binary response

- Adjust the middleware example to be a bit nicer
2018-08-19 19:50:07 -07:00
Connor Prussin
4c9acefaea
Set the Content-Length header based on the body contents (#93) 2018-07-10 22:23:28 -07:00
Petri Lehtinen
8badd62b3e PureScript 0.12 support (#89)
- Upgrade all dependencies
- Use Effect instead of Eff
- Use Foreign.Object instead of StrMap
- Use Effect.Ref instead of Control.Monad.ST
- Drop SecureServerM, it's the same as ServerM now
2018-07-08 16:16:48 -07:00
Connor Prussin
1f8024643c
Fix compiler warning 2018-02-24 19:57:46 -08:00
Connor Prussin
435003e2ab
Uprev dependencies 2018-02-24 18:51:07 -08:00
Connor Prussin
7c606aec49
Add custom HTTP configurations (#88) 2018-02-08 21:46:45 -08:00
Connor Prussin
0fa3d1a90c Clean up tests and examples (#86) 2017-10-26 17:19:30 -04:00
Connor Prussin
133b98c9c6 Add helpers in Lookup and return a Maybe from lookup. (#84) 2017-10-23 18:50:27 -04:00
Connor Prussin
f38c5987ee Add fullPath function for inspecting and logging full resolved request path (#81) 2017-09-29 09:52:21 -07:00
Connor Prussin
8760334dcd Make response helpers API consistent (#79) 2017-09-29 07:49:46 -07:00
Connor Prussin
f4599b276b Add Headers.empty and Headers.header (#78) 2017-09-29 07:25:31 -07:00
Connor Prussin
48c529e9be Add middleware example (#73) 2017-09-27 12:34:00 -07:00
Connor Prussin
d50be71fdc Make ResponseM async (#71) 2017-09-27 06:55:36 -07:00
Connor Prussin
0e71e9204a Add tooling for working with query parameters (#69) 2017-09-26 00:14:06 -07:00
Connor Prussin
278e110d59 Improve and simplify APIs (#68) 2017-09-25 23:08:07 -07:00
Connor Prussin
bd58415e3b Add SSL support (#55) 2017-08-01 22:08:27 -07:00
Connor Prussin
b88b905dad Code cleanup (#54) 2017-08-01 22:08:27 -07:00
Connor Prussin
008924e861 Code cleanup (#50) 2017-07-20 15:48:59 -07:00
Connor Prussin
930130b624 Support all HTTP status codes (#49) 2017-07-19 11:59:55 -07:00
Connor Prussin
38e6421bc5 Don't hardcode port numbers for examples in integration tests (#46) 2017-07-18 22:44:38 -07:00
Connor Prussin
4f11f25d03 Use new ?= operator instead of Assertions.shouldEqual (#45) 2017-07-18 22:36:56 -07:00
Connor Prussin
be26faa803 Add support for HEAD, CONNECT, OPTIONS, TRACE, and PATCH (#44) 2017-07-18 22:21:36 -07:00
Connor Prussin
b8169e4fdb Add post example (#41) 2017-07-18 10:09:03 -07:00
Connor Prussin
a2d81b8606 Rename top level directories to be purescript standard 2017-07-17 23:29:51 -07:00
Connor Prussin
cfcd867729 Clean up file naming and directory structure (#21) 2017-07-10 12:06:14 -07:00
Connor Prussin
cfd0a4b243 Test all the things! (#20) 2017-07-10 03:17:13 -07:00
Connor Prussin
17d39fcdc2 Initial commit with basic functionality and library structure. 2017-05-25 12:12:29 -07:00