-
Notifications
You must be signed in to change notification settings - Fork 534
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
feat(be): Online debug function adds support for transfer files #1465
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1465 +/- ##
===========================================
- Coverage 68.95% 30.25% -38.71%
===========================================
Files 48 48
Lines 3038 3051 +13
===========================================
- Hits 2095 923 -1172
- Misses 705 1925 +1220
+ Partials 238 203 -35
Continue to review full report at Codecov.
|
Hi, please sync your codes with the master branch to fix the CI failure. |
Thank you. I haven't added the BE E2E test for the corresponding code. I will add it later. |
hi @Jaycean we could add e2e test cases in https://github.com/apache/apisix-dashboard/tree/master/api/test/e2enew |
OK, Thks, all E2E tests are added to the new folder? Or need to add both? |
added to the new folder is ok, thanks. |
api/test/e2enew/base/http.go
Outdated
} | ||
for k, v := range reqParams { | ||
if err := writer.WriteField(k, v); err != nil { | ||
panic(err) |
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.
Ditto.
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.
done.
|
||
reqBody := urlValues.Encode() | ||
|
||
return strings.NewReader(reqBody), contentType, nil |
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.
Put the param
to the body? This confused me.
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.
http.go In the getReader function, It from the old E2E/ http.go.
My idea is that E2E will be rewritten with the new ginkgo, so I migrate it directly here without modifying the code.
My understanding here is to deal with a variety of data formats, such as form-data, JSON, files.
The incoming params may be in a variety of situations. Here is the third one url.Values set reqParams map[string]string
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.
@nic-chen Do you know about this?
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 feel that there is a problem with this. The content of the file should not be read in the test case, but the content of the uploaded file should be read in the main program.
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.
Because the front-end has cross-domain problems, it needs to conduct a transparent transmission through the manage API.
Here, the front-end places the file bytes in the body and transfers them to the back-end, and then directly transmits them through the back-end. Therefore, the E2E test needs to read the file here.
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.
Sorry, my question is that why we should put the reqParams
to reqBody
?
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.
Request params include url, prototal, method, header params and body params, they used to form the new request rewarding by golang.
Before this pr, we put all request params to the request body, and we use json
to transfor data
due to this new feature, the origin request support not only json
, form-data
is accepted. Inorder not to disturb the origin formdata, we put others params including: url, prototal, method and header params to the request header, and the reqest body keep the origin body, so that the forwarding request can use the body directly.
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.
@liuxiran Thanks for the explanation. 😄
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Backport patches
Related issues
support debug file transfer in online debug #1217
Feat: Rewrite all E2E tests using the Ginkgo #1500
New feature or improvement