Commit Graph

82 Commits

Author SHA1 Message Date
Miran 5d5dc51bac
update ci.yml to test Nim 2.2; also test gcc-14 (#82) 2024-09-11 07:28:48 +02:00
Miran 2190421e09
update ci.yml and be more explicit in .nimble (#80)
Also, use `results` instead of deprecated `stew/results`.
2024-06-26 10:10:35 +00:00
Shuu a9687dda1c
Add examples (#78)
* Add tiny example

* fix basic exmaple

* Add server/client exmaples

Co-authored-by: Emil Ivanichkov <emil.ivanichkov@gmail.com>

---------

Co-authored-by: Emil Ivanichkov <emil.ivanichkov@gmail.com>
2024-03-11 17:16:07 +02:00
Eugene Kabanov 223aadeb82
Add implementation of PRESTO middleware. (#73)
* Add implementation of PRESTO middleware and tests for it.

* Address review comments.

* Recover log statements which still has sense.
2024-02-21 15:49:36 +02:00
tersec 046bd4a06b
use non-EOL macOS version for GitHub Actions CI (#76) 2024-02-16 16:53:16 +00:00
tersec b751ffa7b6
test refc in CI in Nim 2.0 and later (#75) 2024-02-14 02:36:37 +00:00
Eugene Kabanov 8e95e747d1
Add ResolveAlways flag to RestClient which will force DNS resolution process for every call to remote REST server API. (#74)
Add tests.
2024-02-02 03:11:28 +02:00
Jacek Sieka 9ba9980091
import/export httpserver from route (#71)
needs and exposes `HttpRequestRef`/`HttpResponseRef` types from there
2024-01-17 20:12:31 +01:00
Eugene Kabanov 4e172639ad
Adopt asyncraises. (#67)
* Initial commit.

* Adopt recent chronos changes.

* Make presto backward compatible.

* Add TODO comment because of duplicates.
2024-01-17 17:36:23 +02:00
Eugene Kabanov 5ca16485e4
Add guarantees that PRESTO server constructors do not raise exceptions. (#66) 2023-10-31 05:18:35 +02:00
Eugene Kabanov a638b7a05b
Add dualstack support to presto. (#65) 2023-10-30 16:40:41 +02:00
Eugene Kabanov fe26614772
Add for REST server ability to return different error types. (#64)
Add tests.
2023-10-30 11:28:27 +02:00
Eugene Kabanov 82cd8b7ee4
Fix badge link (#63) 2023-10-21 15:15:14 +03:00
Eugene Kabanov 21cf1e9406
Fix error response processing. (#62) 2023-10-21 14:18:46 +03:00
Eugene Kabanov 81250a419b
Fix most of compilation warnings. (#61) 2023-10-19 02:01:28 +03:00
Eugene Kabanov e80546edf2
Add ability to handle REST server errors with custom responses. (#60)
* Add ability to handle REST server errors with custom responses.
Add tests.

* Fix chunked encoding issue.
Add test for chunked encoding.
2023-10-19 01:16:16 +03:00
Eugene Kabanov 2ae448ff5b
Add cancellation leaks tests. (#59) 2023-09-15 21:56:08 +03:00
Eugene Kabanov cb9353acd5
Fix issues. (#58)
* Fix new(RestClientRef) declaration.

* Fix metrics name issue.
2023-09-04 23:34:14 +03:00
Eugene Kabanov eee1f7ad04
Add one more version of `new(RestClientRef)` which accepts HttpAddress. (#57) 2023-09-04 16:10:21 +03:00
Eugene Kabanov a30fcd4c29
Add client and server metrics. (#55)
* Add PRESTO client and server metrics which could be enabled per endpoint.

* Add dependency.

* Fix compilation issue.

* Address review comments.
2023-09-04 16:10:11 +03:00
Jacek Sieka 8bb4a54f47
reduce imports (#56)
not needed, cause both http(s) server and client to be compiled
unnecessarily for any presto usage, including bearssl
2023-08-08 12:13:30 +02:00
Eugene Kabanov dceac3f5cc
Increase backlog defaults. (#54) 2023-08-01 13:28:25 +03:00
Eugene Kabanov 42552611cf
Upgrade trackers (#53)
* Update presto to follow recent changes in chronos.

* Bump to reset CI testing.

* Bump requirements.

* Use chronos@head instead of specific version.

* Use proper delimiter to specify HEAD.
2023-07-17 09:44:27 +03:00
tersec 35652ed19c
remove Nim 1.2 support; test Nim 2.0 in CI (#51) 2023-06-01 13:32:45 +00:00
Eugene Kabanov 64365eb843
Expose HTTP response headers to RestPlainResponse. (#50) 2023-05-26 16:48:01 +03:00
Eugene Kabanov 69b13d5047
Remove `connection` field from logging statements. (#49)
Keep `address` field first.
Fix warnings generated by macro usage.
Fix strutils warning.
2023-05-26 12:52:07 +03:00
Eugene Kabanov 9899be3c7f
Enable chronos.SocketFlags for REST client. (#48)
* Export SocketFlags for REST client.

* Apply fixes to REST client.
Upgrade ci workers 18.04 to 20.04 ubuntu.
2023-05-18 11:22:34 +03:00
Eugene Kabanov 2b440a443f
Allow empty POST requests (without body). (#45)
Add tests.
2023-03-30 21:04:33 +03:00
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