Commit Graph

182 Commits

Author SHA1 Message Date
Jim Crossley 991cdbd01f Use the new iter() fn for message headers
Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-11-04 09:50:08 -04:00
Jim Crossley f4c85cd335 Fixed example
Apps will be required to bump their dep to 0.29, too.

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-11-03 14:13:41 -04:00
Jim Crossley 3c122783ac Bump to latest rdkafka 0.29
Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-11-03 12:49:40 -04:00
Jim Crossley c380078bf4
Fix off-by-one bug in Event serializer (#191)
Fixes #189

Added breaking tests for both V03 and V10 to confirm bug and changed
the logic slightly to clarify intent

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-09-26 12:14:57 -04:00
minghuaw b8487af97c
Show feature gated bindings in documentaion (#187)
* show feature gated bindings in docsrs

* moved crate root docsrs feature

* fixed cargo fmt check

* removed files that should go with another PR

Signed-off-by: minghuaw <michael.wu1107@gmail.com>
2022-08-24 17:30:43 -04:00
dependabot[bot] e2066527e6 Bump terser in /example-projects/reqwest-wasm-example
Bumps [terser](https://github.com/terser/terser) from 4.8.0 to 4.8.1.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-22 16:04:55 -04:00
Jakub Noga 8dde763c06
New feature: NATS bindings (#185)
* feat: add NATS protocol bindings

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* chore: run cargo fix & fmt

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* fix: issues with docs

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* Apply suggestions from code review

Co-authored-by: Lazzaretti <fabrizio@lazzaretti.me>

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* feat: apply suggestions from code review

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* feat: add test for v0.3 deserialization

Signed-off-by: Jakub Noga <jakub.noga@softchameleon.io>

* chore: run cargo fmt

Signed-off-by: Fabrizio Lazzaretti <fabrizio@lazzaretti.me>

Co-authored-by: Jakub Noga <jakub.noga@softchameleon.io>
Co-authored-by: Lazzaretti <fabrizio@lazzaretti.me>
2022-07-12 21:51:04 +02:00
Lazzaretti 6848cb15bd
Merge pull request #177 from cloudevents/dependabot/npm_and_yarn/example-projects/reqwest-wasm-example/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6 in /example-projects/reqwest-wasm-example
2022-07-09 13:37:40 +02:00
dependabot[bot] cb9d9ddf16
Bump minimist in /example-projects/reqwest-wasm-example
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-09 11:22:30 +00:00
Jim Crossley 9882d5c521 Fix reqwest build by enabling js feature
Per https://docs.rs/getrandom/latest/getrandom/#webassembly-support

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-06-14 10:52:44 -04:00
Jim Crossley 8b77dd8c33 Bump uuid dep to version 1
Fixes #183

Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-06-14 10:52:44 -04:00
Jim Crossley 6653e46059 Fix automated tests master->main
Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-06-13 16:02:26 -04:00
dependabot[bot] 87c98aa26e
Bump eventsource in /example-projects/reqwest-wasm-example (#181)
Bumps [eventsource](https://github.com/EventSource/eventsource) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/EventSource/eventsource/releases)
- [Changelog](https://github.com/EventSource/eventsource/blob/master/HISTORY.md)
- [Commits](https://github.com/EventSource/eventsource/compare/v1.1.0...v1.1.1)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-02 09:54:00 -04:00
Yoshiki Kudo 24aec9320c
Support for Axum v0.5.x (#179)
* Support for Axum x0.5.x

* Upgrade axum v0.5 for example-project

Signed-off-by: Yoshiki Kudo <actionstar619@yahoo.co.jp>
2022-05-03 13:47:04 -04:00
dependabot[bot] 515fa81a77
Bump async from 2.6.3 to 2.6.4 in /example-projects/reqwest-wasm-example (#178)
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-02 10:25:42 -04:00
Jim Crossley 2c5933bad4
Prep for 0.5.0 release (#176)
Signed-off-by: Jim Crossley <jim@crossleys.org>
2022-03-16 23:45:46 -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