-
Notifications
You must be signed in to change notification settings - Fork 601
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
Doing base64 encode in channel's responseBody #6542
Doing base64 encode in channel's responseBody #6542
Conversation
Codecov ReportBase: 81.94% // Head: 81.89% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #6542 +/- ##
==========================================
- Coverage 81.94% 81.89% -0.06%
==========================================
Files 235 235
Lines 11738 11756 +18
==========================================
+ Hits 9619 9627 +8
- Misses 1646 1652 +6
- Partials 473 477 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Could I suggest to also create an issue for this? It is at least related to the issue fixed here: knative-extensions/eventing-kafka-broker#2604 Also, it would be nice to have some rekt-test for this, again like in here: https://github.com/knative-sandbox/eventing-kafka-broker/pull/2604/files#diff-0de2d5afb422b7e648e6a13010e4331ecad2c15de240dcea0e8177e263e73e10 |
Sure, I will open an issue and add some rekt-test for this PR |
pkg/channel/message_dispatcher.go
Outdated
@@ -235,15 +236,20 @@ func (d *MessageDispatcherImpl) executeRequest(ctx context.Context, | |||
execInfo.Time = dispatchTime | |||
|
|||
body := make([]byte, attributes.KnativeErrorDataExtensionMaxLength) | |||
readLen, err := response.Body.Read([]byte(body)) | |||
|
|||
// encodeBase64 encodes response body as base64 for the resulting length. |
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.
I think if to long, we reduce it to first 1024
also this might need some reflection on some of the rekt/e2e tests (see failures)
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.
Got it
1a933dd
to
a258baf
Compare
/retest |
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.
/lgtm
/cc @matzew
func TestChannelSubscriptionReturnedErrorData(t *testing.T) { | ||
t.Parallel() | ||
|
||
ctx, env := global.Environment( | ||
knative.WithKnativeNamespace(system.Namespace()), | ||
knative.WithLoggingConfig, | ||
knative.WithTracingConfig, | ||
k8s.WithEventListener, | ||
environment.Managed(t), | ||
) | ||
|
||
createSubscriberFn := func(ref *duckv1.KReference, uri string) manifest.CfgFn { | ||
return subscription.WithSubscriber(ref, uri) | ||
} | ||
|
||
env.Test(ctx, t, channel.ChannelSubscriptionReturnedErrorData(createSubscriberFn)) | ||
} |
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.
Should we additionally add a similar test that used the Broker/Trigger API?
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 extensions is not added in Broker/Trigger, I am working on this PR #6541
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.
Oh, I missed your comment #6541 (comment), thanks!
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liuchangyan, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore, it just breaks any consumer trying to use such info. [1] #6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
) Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore, it just breaks any consumer trying to use such info. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
) (#203) Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore, it just breaks any consumer trying to use such info. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
) Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore, it just breaks any consumer trying to use such info. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
) (#211) Sanitizing the HTTP body was added as a measure to try to handle as many HTTP body as possible, now that we're base64 encoding the error body [1], it is not necessary anymore, it just breaks any consumer trying to use such info. [1] knative#6542 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com> Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Fixes #6547
Signed-off-by: Teresaliu changyan.liu@intel.com
Proposed Changes
Pre-review Checklist
Release Note
Docs