Simple http client Dlang library
Vincent via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Aug 10 17:28:46 PDT 2015
On Saturday, 6 June 2015 at 22:20:20 UTC, kryszczyniak wrote:
> I've created AllUCanGET
I quickly looked at usage of library, for me seems you have no
experience in API design. Look:
1. auto httpclient=new AllUCanGET; - here you could pass URL as a
parameter for constructor (what is in most cases more than enough)
2. httpclient.referer="http://allucanget.diaboli.pl"; - why you
"hardcoded" headers as a properties of httpclient? How many of
'em you support? What about X-* headers? It's bad solution, such
things better to keep in 'dictionary' (array with string indexes).
3. httpclient.postdata="postfield1=value1&postfield2=value2"; -
Manual escaping for data? Serious?
4. httpclient.allucanget(); - WHAT?! :)))))) Is THAT 'allucanget'
a name to make request???
5. writeln(httpclient.response["header"]); - here one more error,
opposite to error you did with headers: THIS 'header' element
should be done as a property, since HTTP _always_ has
header+body! Nobody needs that 'response', people needs data.
I recommend you to delete this approach and rethink how people
should use your 'helper'.
More information about the Digitalmars-d-announce
mailing list