Commit Graph

145 Commits

Author SHA1 Message Date
Jim Crossley 1e89203cbc Make the reqwest/wasm example a little more helpful 2021-10-27 23:18:04 -04:00
Jim Crossley 9480a0e944 Add some example help 2021-10-20 21:46:44 -04:00
Dejan Bosanac 0741f2bf28 Add support for core http crate binding
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-10-08 13:23:28 -04:00
Dejan Bosanac 62b895c025 Display utf8 data as plain text
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-10-04 18:11:43 -04:00
Jim Crossley 934915d910 Fix broken doc links warnings 2021-09-10 13:30:53 -04:00
Dejan Bosanac 1e00f6fe04 Update reqwest wasm example so it compiles and run properly again
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-09-10 10:56:14 -04:00
Jim Crossley 0aeebac010 Refactor Builder Adapter common to both warp and axum
Resulted in some minor code re-org as well

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-09-09 13:27:05 -04:00
Dejan Bosanac 5cc2fddddd Use defined fixtures in tests
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-09-02 09:22:15 -04:00
Jim Crossley 733d568591 Minor docs re Axum 2021-08-31 15:56:43 -04:00
andrew webber (personal) 6074b4db7e Add Axum binding
Signed-off-by: andrew webber (personal) <andrewvwebber@googlemail.com>
2021-08-31 15:40:04 -04:00
Jim Crossley b540542040 Factor common response Builder trait out for actix & warp
This proved very difficult due to the different ownership behavior
between each builder, i.e. warp is a consuming builder, actix isn't.

With the use of the Rc/Cell/RefCell, I worry that this is now more
complex than it was, and for all I know, I've introduced a memory leak
somewhere. :)

Since the reqwest builder is also consuming, it should be able to
follow the same "adapter" pattern as warp. Unfortunately, the reqwest
builder doesn't implement the Default trait, so I can't use take() and
I've yet to come up with another solution.

Since 2/3 of the builders are consumers, it's possible we might
simplify the code by having the new Builder trait reflect that,
i.e. using self instead of &self in the fn params. We'll investigate
that next.

For now, I'm just happy to have 2 builders sharing some formerly
redundant behavior.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-08-25 16:43:27 -04:00
Jim Crossley c4e8780c79 Encapsulate shared event deserialization behind a Headers trait
Both warp and reqwest use the HeaderMap from the http crate. Actix has
its own. Fortunately, both contain (HeaderName, HeaderValue) tuples.

Further, actix uses a conflicting version of the bytes crate, so I
store a Vec<u8> instead of a Bytes member in the Deserializer
struct. Not sure if that's a problem, but the tests pass. :)

We use an associated type in the Headers trait to facilitate static
dispatch for warp/reqwest since their concrete iterator is public, but
the actix Iter struct is private, so we use a Box for its impl.

We're using AsHeaderName for the get() param to avoid having to call
as_str() on any header constants, but of course actix uses its own
AsName trait, which isn't public, so we must call as_str() for the
passed header name in its impl.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-08-25 16:27:32 -04:00
Jim Crossley ca3ba3b88c Move binding/http mod into its own file
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-08-17 11:41:13 -04:00
Dejan Bosanac 96c69d99da Move test_data to main crate
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-07-29 08:58:45 -04:00
Jim Crossley 211792f0f4
Refactor redundant header logic to a shared lib (#146)
* Refactor redundant header logic to a shared lib

* Remove some unused code

* Share macro between actix and warp, eliminating actix header mod

Fixes #145

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-07-23 14:00:26 -04:00
Francesco Guardiani 2cae3f0b36
Bumps + fix version_sync crate (#143)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-07-07 15:15:48 +02:00
Francesco Guardiani bcb8363deb
Fix null context attributes in json (#142)
* Fix null extensions and fields in json

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* fmt

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-07-07 14:49:49 +02:00
Francesco Guardiani 589db8e5be
Renamed features (#140)
* Renamed features
Moved all bindings under a binding crate

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Cargo fmt

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Now this should build

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Use the new cache plugin

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fix

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fix the build

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fixed doc links

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Change link

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-07-07 10:47:30 +02:00
Dejan Bosanac cd98c6705e
Add Actix structured test and clean up a bit (#141)
Signed-off-by: Dejan Bosanac <dejan@sensatic.net>
2021-07-06 15:53:40 +02:00
Jim Crossley f6b45d1af7
Fix broken link (#138)
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-30 16:54:50 +02:00
Jim Crossley e4d3370656
Update README to reflect new structure (#137)
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-30 16:21:30 +02:00
Jim Crossley 432259bd26
De-workspace-ification (#135)
Now that we've refactored the protocol bindings from crates to
feature-guarded modules (PR #131), we can remove the workspaces for
those crates.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-30 14:13:41 +02:00
Francesco Guardiani 12230429b8
Merge pull request #136 from jcrossley3/feature-docs
Document feature flags
2021-06-30 08:56:34 +02:00
Jim Crossley ceb034b813 Document feature flags
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-29 19:23:44 -04:00
Francesco Guardiani dc81cf6cad
Merge pull request #132 from jcrossley3/actix-impls
Implement actix-web FromRequest and Responder
2021-06-29 09:31:09 +02:00
Francesco Guardiani 1a9d0d46fc
Merge pull request #134 from jcrossley3/clippy
Fix clippy warnings
2021-06-29 09:29:37 +02:00
Jim Crossley c1715d75a4 Fix clippy warnings
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-28 11:53:47 -04:00
Jim Crossley d45811604d Implement actix-web FromRequest and Responder
Fixes #130

I'm not entirely sure why this works, but the compiler seems to like
it! :D

The example is intentionally as simple as it gets, but a "real" app
should probably return Result<Event, Error> from its handlers.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-28 11:21:32 -04:00
Francesco Guardiani bf21c52869
Merge pull request #133 from slinkydeveloper/fix_node_example
Node example now builds
2021-06-28 17:14:54 +02:00
slinkydeveloper c57be0b99b Node example now builds
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-06-28 16:39:33 +02:00
Francesco Guardiani 362492fa9a
Merge pull request #131 from jcrossley3/single-crate
Refactor runtime crates into feature-guarded modules
2021-06-25 16:51:45 +02:00
Jim Crossley 4979c44532 Build/Test --all-features for action matrix
For the wasm32 build, we replace --package <<redundant>> with --features cloudevents-reqwest

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Jim Crossley 69f16a5144 Fixed docs
Verified `cargo doc --all-features` works

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Jim Crossley 538b647804 New feature: cloudevents-warp
Conditionally compile warp module when enabled

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Jim Crossley 9055d71fb2 New feature: cloudevents-rdkafka
Conditionally compile rdkafka module when enabled

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Jim Crossley 51b49f1335 New feature: cloudevents-reqwest
Conditionally compile reqwest module when enabled

This resulted in a naming conflict between my desired feature name,
"reqwest", and the optional dependency itself. So I adopted the
convention of prefixing the features with "cloudevents-".

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Jim Crossley 935234a9cb New feature: cloudevents-actix
Conditionally compile actix module when enabled

Mostly straightforward, though I don't particularly love that dev-deps
can't be optional: https://github.com/rust-lang/cargo/issues/1596

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-06-25 10:12:23 -04:00
Matthias Wessendorf 303ed92545
💄 Use stream() instead of deprecated start() (#126)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2021-05-24 09:23:07 +02:00
dependabot[bot] a1358ea5b7
Bump url-parse in /example-projects/reqwest-wasm-example (#122)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-17 11:05:15 +02:00
Jens Reimann dfe2bcce13
Fix tests after refactoring URIRef (#116)
Signed-off-by: Jens Reimann <jreimann@redhat.com>
2021-04-21 11:09:24 +02:00
Jens Reimann 62ca1cd7da
[#106] Allowing handling URI-ref types (#115)
Signed-off-by: Jens Reimann <jreimann@redhat.com>
2021-03-05 09:20:52 +01:00
Francesco Guardiani da40d3d563
Tokio 1.0 release bumps! (#113)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-02-08 16:39:11 +01:00
Francesco Guardiani 364ad7b41e
Release 0.3.1 bumps (#111)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-01-18 18:13:34 +01:00
Andrew 4cb40f98a4
Latest serde breaks cloudevents-sdk (#110)
serde::export::Formatter -> std::fmt::Formatter
Signed-off-by: andrew webber (personal) <andrewvwebber@googlemail.com>
2021-01-12 19:10:41 +01:00
dependabot[bot] 7f63bd74ec
Bump ini from 1.3.5 to 1.3.8 in /example-projects/reqwest-wasm-example (#108)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 08:56:56 +01:00
Francesco Guardiani 6f5a767f19
Removing serde-value (#107)
* Removed serde_value

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* clippy + fix

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* cargo fmt

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2020-12-02 18:33:51 +01:00
tottoto 609c036ce5
Fix typo (#101)
Signed-off-by: tottoto <tottotodev@gmail.com>
2020-11-06 10:39:41 +01:00
Francesco Guardiani 570a9ea488
Fix lint warnings (#100)
* Fix clippy warnings

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Cargo fmt

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2020-11-06 10:39:10 +01:00
tottoto 6ac6534f16
Change unused dependency to dev_dependency (#103)
Signed-off-by: tottoto <tottotodev@gmail.com>
2020-11-06 10:38:42 +01:00
tottoto 579665f226
Remove actix_rt dependency in actix_web example (#102)
Signed-off-by: tottoto <tottotodev@gmail.com>
2020-11-06 09:35:39 +01:00