error: use application/json as the content-type

Fixes #1584
hmmm, in some places we trim and in others we append a newline to the wbody... should really standardise this