luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

Add options table to coro-http request #278

Closed JohnnyMorganz closed 3 years ago

JohnnyMorganz commented 4 years ago

Continuation of https://github.com/luvit/lit/pull/230

coro-http currently does not have the functionality to prevent following redirects.

This PR adds an options argument to the request function, which is a table of possible options for the request This also replaces the timeout argument, which has now been moved into the options table, making it look like:

options
    timeout (number) - Default: nil
    followRedirects (boolean) - Default: true

This also allows more options to be added over time as required.

For backwards compatibility, if a number is provided instead of a table to the options parameter, it is assumed as the timeout.

JohnnyMorganz commented 4 years ago

Noticed a bug in how I handled if customOptions was a number, this should be fixed

SinisterRectus commented 3 years ago

Looks good to me. Can you bump package.version to 3.2.0?

JohnnyMorganz commented 3 years ago

Apologies for the delay again, bumped package.version