Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support case insensitive cloudevent payloads and forward cloudevent props s headers #1153

Merged
merged 12 commits into from
Oct 17, 2024

Conversation

IliasP91
Copy link
Contributor

@IliasP91 IliasP91 commented Sep 25, 2023

Description

Extend the existing CloudEvent Middleware to:

  • Accept case insensitive cloudevent payloads
  • Extend its options to forward cloudevent props as HTTP Request.Headers

This will make the middleware accept JSON payloads that are Pascal cases, as the default ASP Net core options already do.
And add the option to forward all the cloud event properties that are not automatically forwarded by the Dapr sidecar as headers. I had a use case where I wanted to read the type of the event (not just filter it) in my handler and currently there is no way of doing it as the middleware just unfolds the cloudevent envelope and discards it.

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation (NA in this case there's no section that describes the UseCloudEvents() method, happy to create one of you think its valuable. I have extended one of the examples though)

@IliasP91 IliasP91 requested review from a team as code owners September 25, 2023 23:03
@IliasP91 IliasP91 force-pushed the feature/forward-cloud-event-properties branch from 1c3a2a4 to cb811e6 Compare September 25, 2023 23:11
@IliasP91 IliasP91 force-pushed the feature/forward-cloud-event-properties branch from f1f6741 to 004a985 Compare October 4, 2023 21:18
@IliasP91 IliasP91 force-pushed the feature/forward-cloud-event-properties branch 4 times, most recently from 59fdc8b to b42cf63 Compare October 13, 2023 19:20
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
Signed-off-by: Ilias Politsopoulos <[email protected]>
@IliasP91 IliasP91 force-pushed the feature/forward-cloud-event-properties branch from b42cf63 to c58b307 Compare October 13, 2023 19:21
@IliasP91
Copy link
Contributor Author

IliasP91 commented Dec 1, 2023

hi again, could someone have a look at this PR? I has been sitting there for a few months now...

Copy link
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@IliasP91 Thank you very much for your contribution - sorry for the delay in merging it!

@WhitWaldo WhitWaldo merged commit d5c32f4 into dapr:master Oct 17, 2024
10 checks passed
humandigital-michiel pushed a commit to humandigital-agency/dapr-dotnet-sdk that referenced this pull request Oct 23, 2024
…rops s headers (dapr#1153)

* forward cloudevent props
Signed-off-by: Ilias Politsopoulos <[email protected]>

* refactor middleware
Signed-off-by: Ilias Politsopoulos <[email protected]>

* add cloud event property filters
Signed-off-by: Ilias Politsopoulos <[email protected]>

* update string check
Signed-off-by: Ilias Politsopoulos <[email protected]>

* forward cloudevent props
Signed-off-by: Ilias Politsopoulos <[email protected]>

* refactor middleware
Signed-off-by: Ilias Politsopoulos <[email protected]>

* add cloud event property filters
Signed-off-by: Ilias Politsopoulos <[email protected]>

* update checks
Signed-off-by: Ilias Politsopoulos <[email protected]>

---------

Signed-off-by: Whit Waldo <[email protected]>
Co-authored-by: Whit Waldo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants