-
Notifications
You must be signed in to change notification settings - Fork 444
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
HTTP 400 Bad Request On Download #77
Comments
Can you share the code you're using and the full output of the 400 error you're seeing? The |
I was using the lib as a Nuget in a Xamarin Forms project. The library was working just fine on both Android and iPhone but then, something changed at Dropbox and we started having the following error [image] on Android. The lib continues to work just fine on iPhone. I then switched to the lib compiled on my machine and fixed the bug with the method I described before. I will post the full stack trace when I'm back at the office ... |
Thanks! That error says that the client is actually sending a "Content-Type" of "application/x-www-form-urlencoded". That was never valid for API v2, and the SDK doesn't set it, so it appears that something else on the system is overriding and setting it. In any case, the .NET SDK isn't officially supported for Xamarin, but I'll pass this along as a feature request. |
I would very much appreciate this being fixed. Wouldn't commenting out this line be an easy fix?
|
@tipa Thanks for the note. The team hasn't worked on implementing and testing official support for Xamarin in this SDK, but I'll add your vote to the feature request. |
Thanks! |
I had the same issue on Xamarin.Android native, HttpClientHandler worked for me too. Thank you @tipa! |
I also had this error or issue on Xamarin Forms Android application (UWP and iOS worked fine) , the HttpClientHandler workaround worked for me too. Thank you @tipa! |
tipa, thank you very much. i spent 1 week to resolve this problem. i had code in windows desktop app. but same code could not work in Xamarin. |
Thank you @tipa !! It helps me. |
It appears that my previously posted workaround stopped working after migrating my project to a Android .NET6. I now was able to implement an alternative workaround:
@greg-db would it be possible to fix this in the SDK as suggested here? |
@tipa Thanks for the note! We have filed this as a request with the team to officially support this SDK in Xamarin, such as potentially include that fix, but I don't have any news on that. |
Has there been any feedback from the team on this? |
@tipa No, I don't have any news on this. Thanks for the feedback! You can certainly integrate against the API directly without using the SDK if you prefer. You can find the documentation for the HTTPS endpoints here. |
@tipa Where is the AndroidMessageHandler class that you inherit from? I typed that in in Visual Studio, but it's not coming up with any suggested usings for it. I'm wanting to implement this again now in MAUI/.NET8 (having previously done so the old way in Xamarin, which as you say doesn't work anymore). |
@SmartmanApps I'm also experiencing this in MAUI/,NET9 on Dropbox.Api 7.0.0. Would really appreciate a fix from the Dropbox team. |
Anyone else with this issue in MAUI, the following should work: new DropboxClient(refreshToken, appKey, new DropboxClientConfig() { HttpClient = new HttpClient(new SocketsHttpHandler())}) |
The server now returns an HTTP 400 Bad Request on a files/download call to the API because of missing Content-Type.
In DropboxRequestHandler.cs, line 443, the Content type for RouteStyle.Download is set to null while the server needs at least a text/plain.
I simply removed the line setting the Content-Type null and it worked with the default Content-Type value. I guess the long term solution should be more in line with the API requirements.
`case RouteStyle.Download:
request.Headers.Add(DropboxApiArgHeader, requestArg);
`
The text was updated successfully, but these errors were encountered: