-
Notifications
You must be signed in to change notification settings - Fork 5
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
api: add HTTP-like object uploader #124
Conversation
I receive an error while trying to use custom multipart reader:
It's line neofs-rest-gw/handlers/multipart/multipart.go Line 343 in 312cb7d
|
u dont need this manual multipart decoder neofs-rest-gw/handlers/objects.go Lines 819 to 830 in 312cb7d
try this: if swagFile, ok := params.File.(*swag.File); ok {
header = swagFile.Header
file = swagFile.Data
} else {
const fileKey = "file"
file, header, err = params.HTTPRequest.FormFile(fileKey)
if err != nil {
resp := a.logAndGetErrorResponse(fmt.Sprintf("get file %q from HTTP request", fileKey), err)
return errorResponse.WithPayload(resp)
}
} |
396c21d
to
8e80e09
Compare
Thanks, @cthulhu-rider I've used that. When I tried to run the test cases, I noticed that http-gw doesn't care about the naming of the field for upload. In the examples (https://github.com/nspcc-dev/neofs-http-gw/blob/0b22557622db8551bfbfc8d0ff0fde51fbdea9c3/README.md#L538), I see the |
definitely strict behavior. There may be several files in any request. API server must clearly distinguish them on the server and require strict compliance with the protocol for system stability.
it's an incorrect behavior to me that will break if we add one more file into the request. Lucky we dont care bout HTTP GW anymore
|
8e80e09
to
2aed76e
Compare
handlers/objects.go
Outdated
//swagFile *swag.File | ||
//ok bool |
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.
Looks like unused, it is better to remove
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.
Yep, you're right, fixed. And also rebased to fresh master state.
c002c0a
to
b8f60d3
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #124 +/- ##
==========================================
+ Coverage 13.70% 14.27% +0.57%
==========================================
Files 10 10
Lines 2080 2262 +182
==========================================
+ Hits 285 323 +38
- Misses 1765 1908 +143
- Partials 30 31 +1 ☔ View full report in Codecov by Sentry. |
@@ -1200,3 +1232,17 @@ definitions: | |||
- success | |||
example: | |||
success: true | |||
AddressForUpload: |
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.
is this redundant while having
Lines 994 to 1007 in eee7071
Address: | |
description: Address of the object in NeoFS. | |
type: object | |
properties: | |
containerId: | |
type: string | |
objectId: | |
type: string | |
required: | |
- containerId | |
- objectId | |
example: | |
objectId: 8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd | |
containerId: 5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv |
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.
No, while we are keeping the rest-gw in a working state and want to pass tests for http-gw. This is because the tests require object_id
and container_id
, but we've had containerId
and objectId
.
b8f60d3
to
9302510
Compare
Add `POST /upload/{cid}` API. Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
Fix filename and Content-type for GET and HEAD APIs. Fix cookie prefix for bearer token. Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
9302510
to
404baff
Compare
Add
POST /upload/{cid}
API.Close #111.