Commit Graph

54 Commits

Author SHA1 Message Date
Eugene Kabanov ba20cebf0f
Add feature to enable HttpSessionRef idle timeout/period tuning. (#44) 2023-03-22 13:20:49 +02:00
cheatfate dc9829e24a
Remove nimble.lock to solve the issue with Nim 1.6/devel. 2023-03-22 00:58:19 +02:00
tersec 18837545f3
disambiguous set 2023-02-24 14:45:00 +00:00
Jacek Sieka a6c32794bf
normalise nimble (#42) 2022-12-09 09:17:13 +01:00
Eugene Kabanov 8bc34dd6f6
REST client connection management via connection pragma. (#41)
* Add REST client connection management pragma `connection` and tests.

* Fix merge issues.
2022-10-13 11:33:13 +00:00
Eugene Kabanov c784f3afb5
Allow REST client API functions to return HttpClientResponseRef. (#40)
* Initial implementation of HttpResponseRef support as result of calling REST API function.

* Fix missing return type.
Add tests.
2022-09-28 07:49:22 +00:00
Eugene Kabanov b1a02537b0
Fix shallowCopy nim-devel issue. (#39) 2022-09-28 06:04:08 +00:00
Eugene Kabanov c17bfdda2c
Add REST status response (HTTP status code without any content). (#38)
Add new tests and fix old tests.
Fix content-type requirements for empty requests.
2022-09-27 15:18:06 +00:00
Eugene Kabanov 545849eebe
Support new chronos.Content-Type header parser. (#37) 2022-09-17 07:37:54 +03:00
Jacek Sieka 3984431dc0
add missing imports (#36)
`options` no longer exported by chronos
2022-09-05 19:40:17 +02:00
zah d298b0ba30
text/text is not a standardized content type (#34)
https://www.w3.org/Protocols/rfc1341/7_1_Text.html
2022-08-10 01:06:26 +03:00
Eugene Kabanov b3dc03be6e
Use new Content-Type parser and adopt ContentBody structure for it. (#32) 2022-08-06 11:35:46 +03:00
tersec ec92aab102
--styleCheck:error (#31)
* --styleCheck:error

* --styleCheck:error iff >= Nim 1.6

* use supported macOS CI image
2022-07-26 13:57:02 +00:00
Ivan Yonchovski 38abeb29fc
Add setup files (#29) 2022-07-25 22:08:02 +03:00
Eugene Kabanov 6e36cbc474
REST API response HTTP headers modification. (#28)
* Add support for HTTP response headers modification.

* Add tests for responses with headers.
2022-06-20 02:04:28 +03:00
Miran 4609bec638
move -d:nimRawSetjmp to nim.cfg (#27)
Refs https://github.com/status-im/nimbus-build-system/issues/44
2022-06-19 11:48:32 +03:00
Zahary Karadjov 1dba6dd6f4
Don't return 403 on "failing" CORS requests 2022-02-14 14:34:42 +02:00
Zahary Karadjov d82574ba24 Quick and dirty minimal implementation of CORS 2022-02-12 00:26:04 +02:00
cheatfate 668a2369f6 Enable usage of constants in `accept` pragma. 2022-02-08 11:16:22 +02:00
Emil 22746c5cd2 Fix `preferredContentType` calls
This change is needed due to refactoring of `preferredContentType` proc
in `nim-chronos`
2022-01-25 18:25:45 +02:00
Ștefan Talpalaru 962bb588d1
CI: test with multiple Nim versions (#22) 2022-01-10 00:51:40 +01:00
Zahary Karadjov 80ebc5b419
Allow the 'api' macro to be used in generic functions 2022-01-06 20:20:20 +02:00
Zahary Karadjov fba35d5a67 Add support for passing extra headers in HTTP requests 2021-12-22 08:00:51 +02:00
Eugene Kabanov de7f923c6b
More debug helpers (#18)
* Add connection_id to logs.
Add more logs.

* Fix chronicles issues.

* Fix SIGSEGV.

* Fix HTTP status logs.

* Bump chronos requirement to 3.0.9.
2021-12-03 18:14:25 +02:00
Eugene Kabanov c41bc8aefc
Add router.rawApi() macro and tests. (#17) 2021-11-29 17:14:10 +02:00
Etan Kissling 5a828c3ef1
fix `it` -> `is` typo (#16)
This fixes a minor typo in the log message `Request it not part of api`
and changes the `api` to uppercase for consistency with the other logs.
2021-11-27 03:22:25 +02:00
Etan Kissling bfcbeceb65
allow reserved Nim keywords as REST params (#15)
This resolves a compilation error when specifying a reserved Nim keyword
as a REST parameter. The error was `node lacks field: strVal`, as the
corresponding identifiers need backticks embedding, e.g., `` `let` ``,
requiring an additional unwrap of `nnkAccQuoted` to get the raw ident.
2021-10-28 19:00:14 +03:00
Eugene Kabanov 89d321bc16
Attempt to fix Windows CI toolchain issue. (#14) 2021-09-07 14:00:25 +03:00
Eugene Kabanov 9a7e711e22
Add Accept handling to REST server and client. (#12)
* Add Accept handling to REST server and client.
Add proper tests to server and client's test suites.
Fix some warnings.
Bump some nimble dependencies.

* Remove debugging echo.
2021-09-07 13:28:56 +03:00
Eugene Kabanov e96c6ded2a
Fix compilation warnings. (#13) 2021-08-13 03:14:46 +03:00
Eugene Kabanov 63fcc3df78
Fix request should be closed only at the end. (#10)
* Fix request should be closed only at the end.

* Final fix.
2021-06-10 20:35:08 +03:00
Eugene Kabanov 0c8c3a584d
Fix AsyncStreamIncompleteError exception leak. (#9)
* Fix AsyncStreamIncompleteError exception leak.

* Fix mistype.
2021-06-04 05:01:28 +03:00
Eugene Kabanov 5163805723
Add flag to pass comma delimited arrays by REST client. (#8)
Simplify server array decoding.
Add tests for comma delimited arrays.
2021-05-18 00:42:35 +03:00
Eugene Kabanov 37b25eaf2c
Move RestError declaration to common. (#7) 2021-05-15 02:39:22 +03:00
Eugene Kabanov db39cdcdc7
Fix chronicles compilation issue. (#6)
Export address variable.
2021-05-14 16:02:03 +03:00
Eugene Kabanov 80e28d15d6
Custom Response types introduced RestStatus, RestResponse[T], RestPlainResponse. (#5)
Added tests.
2021-05-11 18:31:43 +03:00
Eugene Kabanov ccebd5ee12
Optimize CI config. (#4) 2021-05-10 12:42:44 +03:00
Eugene Kabanov d0ed144b9c
Rest client (#3)
* Separate some macro helper procedures to common module.
Initial commit for client.

* Arguments pre-processing and createPath() with tests.

* Further progress on arguments.

* Add method checks.

* REST client release candidate.

* Add redirection support to client requests.
Move all network logic to procedures.
Add first test.
Add PrestoIdent default to REST server and client.

* Add agent.

* Fix url encoding in request's path.

* Fix client url-encoding handling.
RestApiResponse become case-object.
Make `-d:nimDumpRest` the only one dumping procedure.
Add rest client tests.

* Add logging support.

* Bump chronos dependency version.
2021-05-10 11:28:58 +03:00
Eugene Kabanov 8943d3fd6c
Merge pull request #2 from status-im/redirect
Add `redirect` macro to allow path redirection.
2021-04-13 13:16:53 +03:00
cheatfate 991b5836f6
Add `redirect` macro to allow path redirection.
Add tests for `redirect` macro.
Add check for unique patterns in path and tests.
2021-04-13 11:56:21 +03:00
Eugene Kabanov 04c2258721
Merge pull request #1 from status-im/presto-engine
Initial implementation.
2021-03-25 12:08:46 +02:00
cheatfate ebb2c16c0d
Annotate callback with raises and perform fix for it. 2021-03-25 11:26:16 +02:00
cheatfate 2f01c838c6
Finally address comment about processRestRequest().
Fix compiler warning for testbtrees.
2021-03-25 10:35:58 +02:00
cheatfate 670f68acd1
Attempt to address comment with processRestRequest[T]() procedure. 2021-03-25 10:05:59 +02:00
cheatfate 6687601ebb
Address review comments part 1. 2021-03-25 00:29:56 +02:00
cheatfate 32085aa97b
Add SecureRestServer implementation and tests. 2021-03-24 15:52:11 +02:00
cheatfate ae185d2038
Fix presto to follow latest changes in chronos servers split. 2021-03-17 15:53:11 +02:00
cheatfate f2a51369d2
Change REST api error response to custom message with custom content-type. 2021-03-11 14:31:14 +02:00
cheatfate a61baae44c
Fix 32bit issues in tests. 2021-03-02 20:18:44 +02:00
cheatfate 1b94fe21dd
Fix one more path problem. 2021-03-02 16:58:07 +02:00