-
Notifications
You must be signed in to change notification settings - Fork 79
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
Switch description from query parameter to form data sending deploy description to dag server #1726
Conversation
pkg/fileutil/files_test.go
Outdated
@@ -814,6 +820,7 @@ func (s *Suite) TestUploadFile() { | |||
TargetURL: server.URL, | |||
FormFileFieldName: "file", | |||
Headers: headers, | |||
Description: "This is a test description", |
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.
Can we update this test case to check the contents of the request, to verify the file contents and the description are in there?
pkg/fileutil/files_test.go
Outdated
@@ -632,6 +632,7 @@ func (s *Suite) TestUploadFile() { | |||
TargetURL: "http://localhost:8080/upload", | |||
FormFileFieldName: "file", | |||
Headers: map[string]string{}, | |||
Description: "This is a test description", |
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.
We should also include a test with the description set to an empty string and Jeremy's comment to ensure regression is intact.
for more information, see https://pre-commit.ci
…ub.com/astronomer/astro-cli into add-description-to-uploadfile-formdata
req.Header.Set(k, v) | ||
} | ||
setHeaders(req, headers) | ||
|
||
client := &http.Client{} | ||
response, err := client.Do(req) |
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 only tested for no description. I was unable to fully test the description. When logging the request body just before and after this line response, err := client.Do(req)
, I noticed that no data is logged after the request is sent.
Given this, simulating and testing for the description field and even file did not quite work.
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 do not have the permission to merge. I need help merging this @neel-astro |
…escription to dag server (#1726) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pgvishnuram <vishnu@astronomer.io> Co-authored-by: Neel Dalsania <neel.dalsania@astronomer.io>
Description
This PR modifies the way the
description
is handled in theUploadFile
function. Previously, thedescription
was passed as a query parameter in the URL. It is now switched to be sent as form data along with the file in the multipart request.Key changes:
description
from a query parameter to form data.description
field to theUploadFileArguments
struct.UploadFile
function to handle thedescription
as form data.This change improves the handling of spaces and special characters in the
description
, avoiding issues caused by URL encoding.Related astronomer/issues/issues/6663
🧪 Functional Testing
TestUploadFile
to reflect this change.📸 Screenshots
📋 Checklist
make test
before taking out of draftmake lint
before taking out of draft