YunServer and HTTP Headers


I'm using the YunServer lib with the Bridge example on an Arduino Yun.

Is there a way to send back a custom HTTP header with this library ?

Thanks :)

Yes there is, although it's still undocumented Instead than just printing the body of your response begin with

client.println("Status: 200");
client.println("Content-type: application/xml");
// any other header
client.println(); //mandatory blank line
client.print(.....) //the response body

Thanks !

That's what I was looking for. :)

This is really useful info, just want throw my support in for documenting it somewhere.

Just curious, do you think the behavior will change in the future and want to keep it undocumented for now? If not and it's fairly stable I'd suggest updating the bridge example to write out the status code and content type (even if it's redundant with the default of plain text) and add a comment that they can be changed. This will greatly help folks like me who want to make an API but can't see how to send different status codes or content types. Unfortunately google doesn't seem to index this board so it's very difficult to find this information right now.

I'd say we should make a TemperatureWebPanel example that outputs json instead of plain text. What do you think? Can you post an issue on github so that we include it in the next IDE release?