Add optional headers to the PostAgent (thanks @eskim!)

This is a slight revision on #218, thanks to @eskim.