JakobGreen / lua-requests

Requests for Lua!
MIT License
217 stars 35 forks source link

Copas integration? #7

Closed hishamhm closed 8 years ago

hishamhm commented 8 years ago

Hi,

I'm looking into using lua-requests in an application that uses a Copas event loop. Peeking into the module, I realized I can achieve this doing:

local copas_http = require("copas.http")
local requests = require("requests")
requests.http_socket = copas_http
requests.https_socket = copas_http

...but this doesn't seem documented in the API, and I'd prefer not to rely on undocumented features.

I do see requests.http_socket and requests.http_socket are public fields in the module, though, so maybe if they were meant to be an implementation detail they'd be hidden in _requests. Is the intention of these two fields to be user-tweakable like I'm doing above? If so, would it be possible to document this explicitly in the API? Thank you!!

JakobGreen commented 8 years ago

That was the original intent of those fields. I wanted to be able to tweak them. I will make sure to document that. Thanks!