🟧HTTP

Improved version of the HTTP function

gpm.HTTP( table parameters ) -> Promise

Function will automatically use third-party http clients such as gm_chttp and gmsv_reqwest.

This function will always return a promise.

This function uses the HTTPRequest structure but will ignore the failed and success keys, which are replaced here by promise.

Resolve Result

keytype

code

body

headers

Reject Result

Rejection result is always a string.

Usage Example

local promise = gpm.HTTP( {
    ["url"] = "docs.pika-soft.ru"
} )

promise:Then( function( result )
    print( result.code, #result.body )
end,
function( errorMessage ) 
    print( "Failed!\n\t", errorMessage )
end )

-- 200	179175
-- 200	225167

Last updated