CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
MIT License
134 stars 67 forks source link

Feature: Support for Multipart Requests #6

Closed TheHemantKaushik closed 4 years ago

TheHemantKaushik commented 4 years ago

Getting error when trying to send multipart request like this. No header is added.

    var request = MultipartRequest(
      "POST",
      Uri.parse("url"),
    );
    var file = await MultipartFile.fromPath("name", "path");
    request.files.add(file);
    var response = await client.send(request);

How can I send multipart request with all headers added in interceptor?

CodingAleCR commented 4 years ago

Hey, I might need to look into this, in theory they should be applied all but to be honest I did not think to implement this at the start, I'll try to look into it and get back to you as soon as I can to figure out if it is something in the roadmap or if it is something we can do currently.

CodingAleCR commented 4 years ago

As of right now this plugin does not support MultipartRequests. I will add it to the roadmap since it is a huge improvement. Cheers!

januwA commented 4 years ago

Hi, try using this branch, I added the postFile method to client to simplify sending files. 😃

dependencies:
  http_interceptor:
    git:
      url: https://github.com/januwA/http_interceptor.git
      ref: master
chitgoks commented 4 years ago

@januwA great job! just what i was looking for! Got stuck with MultiPartRequest then tried to open up a new issue and found this is already existing.

CodingAleCR commented 4 years ago

Agreed, I'm sorry for not being able to look into this and add it. I'm aiming for a 0.3.0 release with this in. Hopefully it happens soon.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

CodingAleCR commented 4 years ago

This has been added to the private backlog that I will use for handling tasks, features and bugs. I will close this and refer back to it once the feature is ready.