1

I want to upload an image to dropbox using their API with http in flutter but dropbox API content-type is 'application/octet-stream', when I tried using http content-type like this(appplication/json) but not working, How can I use this application/octet-stream as my Http content type in flutter

1

2 Answers 2

2

Try to do something like this:

http.post(url,
  headers: {"Content-Type": "application/octet-stream"},
  body: your-image-data
Sign up to request clarification or add additional context in comments.

1 Comment

I have a lot of headers so, I have to use Map. like this Map<String, String> requestHeaders = { 'Content-type': 'application/octet-stream', 'User-Agent': 'api-explorer-client', // 'Dropbox-API-Arg': '{"path": "/EasyBay/Project1/image.txt"}', 'Authorization': 'Bearer' + token }; Yet, It's not working.
1

in dio

Dio dio = Dio()..interceptors.add(InterceptorsWrapper(
  onRequest: (RequestOptions options) async {
    options.headers
      ..addAll({
        'platform': 'xxxx',
        'token': 'xxx'
      });
    return options;
  }
))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.