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

WIP: separate interface into immutable and mutable #5

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ma2gedev
Copy link
Member

⚠️ 💣 CAUTION: Do not merge! I only checked to pass build, didn't check on product code(I'm in holiday 🌴).

Rough sketch of HttpRequestInfo separation discussed on #4 (comment) .

Change summary is the following:

  • divide interface HttpRequestInfo and MutableHttpRequestInfo, the latter is for mutating headers
  • SpringHttpRequestInfo::trySetHeader receives only acceptable header names, the function should not be accept some headers

Is the design good? Please send me a feedback.

@@ -65,7 +66,7 @@ class M3OpenCensusTracer internal constructor(

override fun processIncomingHttpRequest(request: HttpRequestInfo): HttpRequestSpan = httpRequestTracer.processRequest(request)

override fun processOutgoingHttpRequest(request: HttpRequestInfo): HttpRequestSpan = httpRequestTracer.processClientRequest(request)
override fun processOutgoingHttpRequest(request: MutableHttpRequestInfo): HttpRequestSpan = httpRequestTracer.processClientRequest(request)
Copy link
Contributor

@saiya saiya Oct 22, 2019

Choose a reason for hiding this comment

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

Advanced recommendation: How about renaming existing HttpRequestInfo to IncomingHttpRequestInfo and also rename MutableHttpRequestInfo to OutgoingHttpRequestInfo ?

And make common super-interface HttpRequestInfo to avoid copy-and-paste (IncomingHttpRequestInfo extends HttpRequestInfo and OutgoingHttpRequestInfo extends HttpRequestInfo).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, that's nice! 👍

@saiya saiya mentioned this pull request Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants