This repository was archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
HTTP CloudEvent coercion #421
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
762b8ff
HTTP CloudEvent coercion
RaeesBhatti 48155e1
Event FromRequest: Dont require path param
RaeesBhatti 79f1cc3
Event: Remove reduant CloudEvent parsing logic
RaeesBhatti ed07412
Event mapHeadersToEvent: Add Extensions if transforming
RaeesBhatti 69c8e84
Router: emitSystemEventReceived on successful event parsing
RaeesBhatti 9d85ec1
Event mapHeadersToEvent: Headers to Extensions
RaeesBhatti c4c594c
Event: Rename a var
RaeesBhatti 2113cf2
Event: New parsing method
RaeesBhatti cac69d6
event.FromRequest: Make data an HTTPEvent if an required
RaeesBhatti fd1eced
Fix some tests
RaeesBhatti fb0057c
Event: Move extensions attachment to New func
RaeesBhatti e32db68
event.FromRequest: use isJSONContent instead of switch
RaeesBhatti 45104ce
event: Simplify a condition
RaeesBhatti 6aba28e
event: Update mapHeadersToEvent func
RaeesBhatti 062cee0
Revert "event: Simplify a condition"
RaeesBhatti f811b6a
Formatting
RaeesBhatti 51fa22c
event: Remove eventType param from parseAsCloudEvent
RaeesBhatti f058d1c
event: Add tests for event.FromRequest
RaeesBhatti b22d3c9
event: Rename HTTPEvent struct to HTTPRequestData
RaeesBhatti 1c2d356
event: Rename func isJSONContent to isJSONMimeType
RaeesBhatti aa265cf
event: Rename func mapHeadersToEvent to parseAsCloudEventBinary
RaeesBhatti 5927f91
event: Remove redundant tests for event.go
RaeesBhatti d6163ab
event: Rename NewHTTPEvent to NewHTTPRequestData
RaeesBhatti c17fa39
router: Fix a struct type in test
RaeesBhatti ceb7240
Format
RaeesBhatti e514de7
event: Merge request.go into event.go
RaeesBhatti 40d0568
event.parseAsCloudEventBinary: Attach Data too
RaeesBhatti b0616aa
event: Update test for CloudEvent from headers
RaeesBhatti 971bb7a
event: Add message for body equality clause TestFromRequest
RaeesBhatti 9fa4dbb
event test: Dont use TransformationVersion as CloudEventsVersion
RaeesBhatti b8e4907
event TestFromRequest: Assert equality of Event.Data when not http event
RaeesBhatti 450030a
event TestFromRequest: Add test for custom event
RaeesBhatti 16600de
Event TestFromRequest: Add test for valid custom CloudEvent
RaeesBhatti 7ec93dc
event TestFromRequest: Change url to example.com
RaeesBhatti 3a17dd2
event TestFromRequest: Add test for invalid custom CloudEvent
RaeesBhatti 1082d05
event.parseAsCloudEventBinary: Change params
RaeesBhatti 7bb9a74
event TestFromRequest: Add loggin for error assertion
RaeesBhatti d7829db
Merge branch 'master' into httpCloudEvents
mthenw bf63c59
inernet/http.FlattenHeader: Make header keys lowercase
RaeesBhatti 7762757
event.parseAsCloudEventBinary: Fix Event.Extensions
RaeesBhatti fc3aa46
event TestFromRequest: Correct expected headers
RaeesBhatti e22b1ff
event TestFromRequest: Assert SchemaURL and Extensions
RaeesBhatti e1933a1
internal/http: Fix tests for FlattenHeader
RaeesBhatti 4ffa7f0
event.FromRequest: Mark http event with JSON content-type
RaeesBhatti 69eb6e5
event.FromRequest: Simplify a condition
RaeesBhatti 8547ba0
event.FromRequest: Move event.Data coercion in
RaeesBhatti 428c0c5
Fix an encoding issue
RaeesBhatti e8cb681
Better content-type detection
RaeesBhatti 6b08ab8
Put the request in http event wrapper
RaeesBhatti 5d1b5a3
Update tests
RaeesBhatti 8297f95
Introduce new flow
929e690
reduce complexity
f853c32
Fix tests
9c7b3db
Add missing file
7f3d0e3
fix remaining tests
18437c3
fix tests
f0a134d
Merge branch 'master' into httpCloudEvents
mthenw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package event | ||
|
|
||
| import "fmt" | ||
|
|
||
| // ErrParsingCloudEvent occurs when payload is not valid CloudEvent. | ||
| type ErrParsingCloudEvent struct { | ||
| Message string | ||
| } | ||
|
|
||
| func (e ErrParsingCloudEvent) Error() string { | ||
| return fmt.Sprintf("CloudEvent doesn't validate: %s", e.Message) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTTP spec says that the header keys are case-insensitive. So, I think it will be better to do a
strings.ToLowerhere for consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's true, but in the same time, when you look at the example in HTTP binding spec you will see that desired behavior is to preserve case (
testExtension).