Commit Graph

167 Commits

Author SHA1 Message Date
Jim Crossley d2ea4faaba Prep for 0.5.0 release
Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-03-16 18:12:24 -04:00
dependabot[bot] 1f29640b50
Bump url-parse in /example-projects/reqwest-wasm-example (#175)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.7...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-16 17:56:24 -04:00
Jim Crossley 5a9f64868d
Update to actix-web 4 (#167)
* Compatiblity with actix-web 4

Fixes #114

Main challenge here was no longer being able to to construct
web::Payload instances from dev::Payload instances. Instead, we now
invoke the web::Payload FromRequest impl directly.

Also adapted to the latest upstream test and body redesign.

Macros are featurized now so enabled default features for the doc
tests to pass.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-02-28 13:02:00 -05:00
dependabot[bot] 6af7d1e8ec
Bump nth-check in /example-projects/reqwest-wasm-example (#174)
Bumps [nth-check](https://github.com/fb55/nth-check) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/fb55/nth-check/releases)
- [Commits](https://github.com/fb55/nth-check/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: nth-check
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-28 12:23:33 -05:00
dependabot[bot] 32b3134981
Bump nanoid in /example-projects/reqwest-wasm-example (#173)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.23 to 3.3.1.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.23...3.3.1)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-28 12:23:08 -05:00
dependabot[bot] 785786f251
Bump follow-redirects in /example-projects/reqwest-wasm-example (#171)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.1 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.1...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-28 12:19:06 -05:00
dependabot[bot] 2742de5307
Bump url-parse in /example-projects/reqwest-wasm-example (#172)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.7.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.1...1.5.7)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-21 09:11:47 -05:00
Roman Kudryashov 2b66c959d1
Bump rdkafka version (#170)
Signed-off-by: Roman Kudryashov <rskudryashov@gmail.com>
2022-02-05 12:07:41 -05:00
Andrew ae83a69f7f
Axum 0.4.0 (#168)
* axum 0.4.0

Signed-off-by: andrew webber (personal) <andrewvwebber@googlemail.com>
2022-01-17 09:23:12 -05:00
Jim Crossley ba798f30cb Fix latest breaking change from poem
Pin to latest version to prevent this in the future

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-01-14 18:51:03 -05:00
Jim Crossley 6d8e78bf99 Fix clippy warnings 2022-01-14 16:14:46 -05:00
Jim Crossley f3d106b3b1
Account for poem 1.2 breaking changes (#166)
* Account for poem 1.2 breaking changes

* Update the poem example, too

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-01-06 00:37:49 -05:00
Jim Crossley 7f538a3f37 Pin poem version to fix CI
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-12-15 09:33:57 -05:00
Jim Crossley 70e3b6681b Fix TryFrom<Data> impl for Vec<u8>
Fixes #163

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-12-15 09:33:57 -05:00
Jim Crossley 65a4782853
Merge pull request #159 from sunli829/master
New feature: cloudevents-poem
2021-11-13 13:00:26 -05:00
Jim Crossley 82f08f85ea Ignore useless warning
Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-11-12 09:13:35 -05:00
Jim Crossley 66b9bfde1b De-macro-fy data parsing
The code is more legible without them, I think. I'm not sure their
complexity is justified.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-11-12 09:13:35 -05:00
Sunli 127d0cec4b Update poem example
Signed-off-by: Sunli <scott_s829@163.com>
2021-11-12 11:38:02 +08:00
Sunli e16e9667cf Add poem-example
Signed-off-by: Sunli <scott_s829@163.com>
2021-11-11 09:34:05 +08:00
Jim Crossley 05807fdf28 Don't fail to deserialize data_base64 even if datacontenttype lies
This fixes #160

From the spec: "When a CloudEvent is deserialized from JSON, the
presence of the data_base64 member clearly indicates that the value is
a Base64 encoded binary data, which the deserializer MUST decode into
a binary runtime data type. The deserializer MAY further interpret
this binary data according to the datacontenttype."
https://github.com/cloudevents/spec/blob/master/cloudevents/formats/json-format.md#312-payload-deserialization

Signed-off-by: Jim Crossley <jim@crossleys.org>
2021-11-10 13:06:24 -05:00
Sunli 8928803e67 Remove useless `in_band_lifetimes` feature
Signed-off-by: Sunli <scott_s829@163.com>
2021-11-10 11:42:45 +08:00
Sunli d987002173 New feature: cloudevents-poem
Signed-off-by: Sunli <scott_s829@163.com>
2021-11-07 10:29:16 +08:00
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