Add Header on HTTP Response Text

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
fede91it
Posts: 19
Joined: 10 Jan 2014 08:59

Add Header on HTTP Response Text

Post by fede91it » 14 Jan 2014 11:59

I've created a flow that allows me to start the AirDroid server through an HTTP Request like 192.168.0.xx/airdroid, and than responds to the client with a redirect instruction pointing to the effective AirDroid server, 192.168.0.XX:8888.

Actually I have to use an html meta refresh tag but it isn't a good solution.
Can you add the possibility to set customized HTTP headers?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Add Header on HTTP Response Text

Post by Martin » 14 Jan 2014 18:12

I can add this to the todo-list.
What kind of headers would you like to set in the HTTP request?

fede91it
Posts: 19
Joined: 10 Jan 2014 08:59

Re: Add Header on HTTP Response Text

Post by fede91it » 14 Jan 2014 20:00

Can you design this new feature in a way that allows to add infinite and customized headers?
I imagine that with a textarea space when I can write some things like:
Header-1: value
Header-2: value
Header-3: etc...
So if anyone in the future needs some special header can set it. It's a bad idea?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Add Header on HTTP Response Text

Post by Martin » 14 Jan 2014 21:02

Sure, it's a good idea to allow arbitrary headers. For me it's also interesting to know what you specifically want to do with the new feature so I don't miss anything important. Do you want to add a header with a text value or a header that needs a special encoding like Base64?
Perhaps I've misread your initial post, do you want to set the headers in an action HTTP Request or in a HTTP response written with action Write HTTP Response Text/File?

fede91it
Posts: 19
Joined: 10 Jan 2014 08:59

Re: Add Header on HTTP Response Text

Post by fede91it » 16 Jan 2014 08:17

I haven't the enecessity of use a base64 value. In the Write HTTP Response Text/File, but howeaver if isn't too hard to implement you can add this feature also in all HTTP like requests/reponses.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Add Header on HTTP Response Text

Post by Martin » 17 Jan 2014 12:25

You can use function setHTTPResponseHeader in a script to add a custom header to a response before the actual response is sent with action Write HTTP Response Text/File:
-trigger HTTP Request: /automagic/*, port 8080
-action Script: setHTTPResponseHeader("headername", "value1")
-action Write HTTP Response Text: <html>...

I've added it to the todo-list to also add custom headers to request.

fede91it
Posts: 19
Joined: 10 Jan 2014 08:59

Re: Add Header on HTTP Response Text

Post by fede91it » 17 Jan 2014 18:27

You are the best, thank you!

Locked