Hi Guys,
As promised, I've further refactored the code of the HTTP Client and
implemented POST, PUT, and DELETE.
The API now looks like the following:
client object
- .put(request) : crafts a put request from the request object,
without modification
- .put(request, body) : crafts a copy of the request and adds a
body, default content-type is 'x-application/octet-stream',
content-length is body.size()
- .put(request, content_type, body) : crafts a copy of the request
and adds a body, content-type is content_type, content-length is
body.size()
- .post(request) : crafts a post request from the request object,
without modification
- .post(request, body) : crafts a copy of the request and adds a
body, default content-type is 'x-application/octet-stream',
content-length is body.size()
- .post(request, content_type, body) : crafts a copy of the request
and adds a body, content-type is content_type, content-length is
body.size()
- .delete_(request) : crafts a delete request from the request object
I have just checked in the code without unit tests -- maybe someone
who knows how to deal with the Python Server (CGI perhaps) and do
POST, PUT, and DELETE handling should take over the testing of this
code?
Any takers? :D
Have a good day everyone! :)
--
Dean Michael C. Berris
Software Engineer, Friendster, Inc.
|