HTTP Request - Form-Data

364 views
Skip to first unread message

Ricardo Moreira

unread,
Jul 24, 2019, 4:25:56 AM7/24/19
to Tasker
Hi, regarding Tasker 5.8’s HTTP Request
I know I can force a POST’s body to be form data by setting the appropriate Content-Type header and properly formatting the input field, and it works great.

But when I also want to upload a file, what’s on the body input field is forced to be an application/json. Is there a way around this?

Also nice boundary.

João Dias

unread,
Jul 24, 2019, 4:51:09 AM7/24/19
to tas...@googlegroups.com
If you explicitly set the Content-Type header it should not be overridden by Tasker automatically.
About sending a file, can you tell me what kind of request the server is expecting?

And glad you like that boundary :D

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/9d3198ea-a99d-4318-a977-654710d2ecdb%40googlegroups.com.

Ricardo Moreira

unread,
Jul 24, 2019, 5:21:19 AM7/24/19
to Tasker
I guess it would’ve been better to post this from the start:

The end result I’m looking for is the following:
curl -F "parameter=asdfgh" -F "hash=asdgh" -F "fileUpload=@file.png" https://test.com

It’s only overriding it when uploading a file. Since a file’s being uploaded, it’s being turned to “multipart/related”, which is fine.
But inside the request body I see

--boundary
Content-Type: application/json; charset=UTF-8.
parameter
=asdfgh&hash=asdgh.

--boundary
Content-Type: application/octet-stream.
...
etc


On Wednesday, 24 July 2019 09:51:09 UTC+1, joaomgcd wrote:
If you explicitly set the Content-Type header it should not be overridden by Tasker automatically.
About sending a file, can you tell me what kind of request the server is expecting?

And glad you like that boundary :D

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


On Wed, Jul 24, 2019 at 9:26 AM Ricardo Moreira <ricardo...@gmail.com> wrote:
Hi, regarding Tasker 5.8’s HTTP Request
I know I can force a POST’s body to be form data by setting the appropriate Content-Type header and properly formatting the input field, and it works great.

But when I also want to upload a file, what’s on the body input field is forced to be an application/json. Is there a way around this?

Also nice boundary.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tas...@googlegroups.com.

João Dias

unread,
Jul 24, 2019, 1:21:37 PM7/24/19
to tas...@googlegroups.com
Oh, you're right! I think I'll just use whatever content-type is in the headers then if it's present :) If not I'll use the standard json one. Sounds good?


Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/b7c0523a-86c7-4f59-9de2-ffc2a512893c%40googlegroups.com.

João Dias

unread,
Jul 24, 2019, 1:39:03 PM7/24/19
to tas...@googlegroups.com
Ok, I changed it: Can you please try this version? https://drive.google.com/file/d/1UfMEt1H6wjlMDdsqByn-flCRqE45PdJ1/view?usp=sharing

Now setting the Content-Type header in the headers will determine what the content type of the body is :)


Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/b7c0523a-86c7-4f59-9de2-ffc2a512893c%40googlegroups.com.

Ricardo Moreira

unread,
Jul 24, 2019, 5:19:07 PM7/24/19
to Tasker
Yeah I tried the APK and it worked great.

Thanks!

On Wednesday, 24 July 2019 18:39:03 UTC+1, joaomgcd wrote:
Ok, I changed it: Can you please try this version? https://drive.google.com/file/d/1UfMEt1H6wjlMDdsqByn-flCRqE45PdJ1/view?usp=sharing

Now setting the Content-Type header in the headers will determine what the content type of the body is :)

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


João Dias

unread,
Jul 25, 2019, 6:16:26 AM7/25/19
to tas...@googlegroups.com
Cool! :D


Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/c97e2f4d-ac77-48b2-bf7a-8181b06b5d18%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages