Conversation
dirkmc
left a comment
There was a problem hiding this comment.
Looks good, just some minor refactoring suggestions
cmd/booster-http/server.go
Outdated
| writeError(w, r, http.StatusBadRequest, "unsupported format") | ||
| } | ||
| } else { // Error if more than 1 format value | ||
| writeError(w, r, http.StatusBadRequest, "unsupported query") |
There was a problem hiding this comment.
Let's try to give the user as much information as possible if they get the parameters wrong:
| writeError(w, r, http.StatusBadRequest, "unsupported query") | |
| writeError(w, r, http.StatusBadRequest, "missing 'format' query parameter") |
There was a problem hiding this comment.
We support no format query and default to a piece in that case. I have changed the error msg to be more detailed though.
There was a problem hiding this comment.
I'm not sure if I'm reading the code correctly, but it looks like it will return an error if the user doesn't specify the format query parameter.
If the user doesn't specify the format query parameter then len(q["format]) will be zero here, right?
if len(q["format"]) == 1
There was a problem hiding this comment.
My bad. Fixing it.
cmd/booster-http/server.go
Outdated
| </td> | ||
| <td> | ||
| <a href="/payload/payloadcid">/payload/<payload cid></a> | ||
| <a href="/piece?payloadCid=bafySomePayloadCid&format=piece" > /payload/<payload cid></a> |
There was a problem hiding this comment.
Let's also change the link target text for these:
| <a href="/piece?payloadCid=bafySomePayloadCid&format=piece" > /payload/<payload cid></a> | |
| <a href="/piece?payloadCid=bafySomePayloadCid&format=piece" >/piece?payloadCid=<payload cid></a> |
Fixes #888