Supports return json type of response#6261
Supports return json type of response#6261zyfjeff wants to merge 15 commits intoenvoyproxy:masterfrom
Conversation
5b13657 to
d441f50
Compare
|
/retest |
|
🔨 rebuilding |
d441f50 to
30c5ae5
Compare
|
Let us know whenever you think this is ready for maintainer review by removing the WIP in the title and I will assign reviewers. Thanks! /wait |
c9f2d89 to
d6b6593
Compare
|
@dnoe I finished, can review. |
|
@dio can you take a first pass on this? |
|
@dio When you have time, help review the code. |
dio
left a comment
There was a problem hiding this comment.
Thanks for working on this! Sorry for the delay.
Looks good. A couple of nits.
There was a problem hiding this comment.
Superfluous spacing? And do you think core data here is the correct title for it?
There was a problem hiding this comment.
Can we expand this comment to tell why we need this?
There was a problem hiding this comment.
This issue mentions the need to remove the dependency of RapidJSON. The json conversion uses the method of protobuf to convert, so I defined a protobuf for converting the local reply body. I am not sure there are other ways to do the same thing.
source/common/http/utility.h
Outdated
source/common/http/utility.h
Outdated
There was a problem hiding this comment.
s/An LocalReplyInfo populated from the/A populated LocalReplyInfo object from a/
8998614 to
12f8e62
Compare
|
/retest |
|
🔨 rebuilding |
|
/retest |
|
🔨 rebuilding |
|
@dio PTAL |
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for this, cool feature. I'm flushing out some initial comments, so let's iterate on these and then once resolved I will take another pass. Thank you!
/wait
There was a problem hiding this comment.
I think maybe call this LocalReply since eventually we might want to include other things in here?
There was a problem hiding this comment.
"Used to wrap a local response, and then convert to JSON."
source/common/http/utility.cc
Outdated
There was a problem hiding this comment.
What's the circular dependency issue here? There must be some way to share this logic without copying? Please try to have a common function that both places call?
There was a problem hiding this comment.
Is a dependent circular reference, Http::Utility references grpc::Common(hasGrpcContentType), grpc::Common refers to Http::Utility(getResponseStatus), so a circular reference is generated, so I copied the hasGrpcContentType method directly here. Implementation.
I don't know which file should be placed on the hasGrpcContentType method so that it can be used together by these two places.
There was a problem hiding this comment.
We should not copy the code, so please create a new file where we can share the logic.
source/common/http/utility.cc
Outdated
There was a problem hiding this comment.
Instead of looking at the content type of the request, shouldn't we be looking at the Accept header here? Also, do we think this overall feature should be configurable? I could go either way, but it definitely needs a release note and needs to be documented.
There was a problem hiding this comment.
Sorry, I got it wrong, it should be using Accept header here.
I don't think it needs to be configured here. this is a standard HTTP server that should be done, and we need to constantly improve it.
|
@zyfjeff 👌🏽 |
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
e414ac9 to
c5c1598
Compare
| // `case normalization <https://tools.ietf.org/html/rfc3986#section-6.2.2.1>` | ||
| google.protobuf.BoolValue normalize_path = 30; | ||
|
|
||
| // Used to configure the Local reply the type of the body |
There was a problem hiding this comment.
This is not super clear. Can you write a more detailed description of what this field is doing?
| ], | ||
| ) | ||
|
|
||
| api_proto_library( |
There was a problem hiding this comment.
I'm not sure if I would consider this a core type. Is this a generic JSON description or very specific to the idea of returning a JSON reply from HCM?
There was a problem hiding this comment.
Yeah, Struct would be the canonical representation of JSON in proto.
|
|
||
| // [#protodoc-title: Local reply configuration] | ||
|
|
||
| // Configure the local reply of the body type |
|
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: tianqian.zyf tianqian.zyf@alibaba-inc.com
Description: Refactor sendLocalReplay and Supports return json type of response
Risk Level: low
Testing: add new unit tests
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue] #6166