- I resolved to test from the client side of the API.
- I encountered an annoying problem and thereby vindicated my efforts.
- I encountered a problem with my test data.
Using my trusty curl command line utility, I was able to figure out what the test data really ought to look like:
test_string() ->
"0000000281|00000000000000000024|"
"POST / HTTP/1.1\r\n"
"User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n"
"Host: localhost:4567\r\n"
"Accept: */*\r\n"
"Content-Length: 24\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"\r\n"
"<body>hello world</body>".
The contents were obtained via
curl -X POST -d @tfile http://localhost:4567
I had to play around with the packet length parameter a bit to get the correct value.
After that, everything just magically worked.
Well, actually it didn't, but it would have been nice if it had.
The next problem I ran into was on account of my lack of familiarity with erlang. I was using a statement like this:
SomeList ++ SomeElement
The problem with this is that the ++ operator really wants to concatenate two lists together, rather than a list and an element. Switching things around a little resulted in erlang being happier:
SomeList ++ [ SomeElement ]
There's probably some other form of syntax that would accomplish this without having to construct a new list, but I don't know what that is at this point.
And that, everything just magically worked.
OK, so that phrase is getting old, but you have to admit, it was funny the first couple of times.
The current problem has something to do with how I'm using dictionaries. That will be the topic for next time.
No comments:
Post a Comment