-
Notifications
You must be signed in to change notification settings - Fork 367
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
Can we allow null as well as "" for contentType args #117
Comments
We can if we think that's an appropriate default. We could look at making it an optional parameter in that case... I've never been sure whether "" is a good content type to specify... |
I don't think there is a good default for content type. However, in this case "" means "no content specified", so null should be allowed for that as well. |
I've been thinking about this a bit - I'm still somewhat uncomfortable about it, particularly as it would end up being returned as "" (I'd hope, anyway). Given that this is a required parameter, and it's just as easy to write Happy to be convinced though :) |
I made contentType an optional parameter for Google Cloud Storage in Q1. If you are still seeing otherwise, it's a service bug you should report. |
Aha. In that case we should make it optional as well, definitely. Thanks Capstan! |
@csells: Let's work out what we want the shape of this to look like. A few options:
Any particular preference? |
Option 1 is my preference. |
Well that's handy, as it should be a trivial change. Will send you a PR shortly... |
(Note that this PR doesn't translate null to "" as the content type as per the original comment - it just doesn't set it, which sounds like it should be fine.) |
Reopening this as it looks like there's other code that does require a content type. |
Pointers? |
@Capstan: I need to look into it tomorrow. |
Okay, found it. It's in the shared resumable upload code, which is what we use for all uploads in the wrapper API. As per https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload, the The simplest fix here will be to just coalesce null to "", as per @csells original comment. Will send that out as a separate PR. |
We need to manually coalesce this, as the resumable upload code requires a content type to be specified, but allows it to be empty. This also removes an overload of UploadObjectAsync which was unnecessary - no doubt overlooked when we introduced optional parameters. Fixes issue googleapis#117.
Aha. That doc is incorrect and was missed when we relaxed that requirement. |
Ah, so it's reasonable to not specify the |
I would not go that far. There exist other uploader service customers besides GCS who may still require it. But it should not be required for all services, no. |
Okay - in that case, we shouldn't prohibit it in the uploader; if it is required and a client doesn't specify it, the server can fail the request - we shouldn't do so too conservatively. Have filed googleapis/google-api-dotnet-client#743 When that's fixed, we can revert some of the previous PR... |
Finally fixed by #176. |
UploadObject fails if there's a null contentType but succeeds if the contentType is "". Can we allow null and translate to "" for the user?
The text was updated successfully, but these errors were encountered: