On Tue, 9 Aug 2016 08:19:10 -0400, Steven Schveighoffer wrote:

I'm not familiar with curl command line. But when I was testing rest
interface, I did it with wget, and you need to add the Content-Type
header. If you notice in your request, the content-type is
"application/x-www-form-urlencoded". Here is what I'd pass using wget:

wget --header=Content-Type:application/json --post-data='{"data":
"there"}' http://localhost:8080/

I'm sure curl supports a similar thing.

Oh, nicely spotted. That's exactly what was wrong; using curl's -H "Content-Type: application/json" option means that suddenly vibe.d is happy and full of beans.

You can use registerWebInterface, and then process the data directly
from HTTPServerRequest parameter. As far as I know, if you want to use
registerRestInterface, you have to play by those rules (Json only). I
have crappy parts of my code where I have to register both a rest
interface for the normal data, and then register web interface when I
want to do something out of the ordinary (including streaming back Json
data!). You may be able to use a @before or @after attribute to process
the data differently.

Oh, nice. I've been working through Kai Nacke's book, but jumped straight to the REST chapter -- ironically, if I'd read the preceding chapter, I'd have already known about the raw web interfaces ...

I'm also just getting into vibe.d, so take my advice with a grain of
salt, maybe there is a way :)

Well, you're at least one step ahead of me and your advice seems good so far ... :-)

BTW apologies for lack of post-DConf follow-up -- I owe you an email one of these days ;-) Hope all is good with you in the meanwhile!

Thanks & best wishes,

-- Joe