Mercurial Hosting > luan
diff src/luan/modules/Boot.luan @ 1364:45363886f256
add url methods
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 29 May 2019 19:03:25 -0600 |
parents | 8d95711f6615 |
children | 836e00bf7ce2 |
line wrap: on
line diff
--- a/src/luan/modules/Boot.luan Wed May 29 15:11:51 2019 -0600 +++ b/src/luan/modules/Boot.luan Wed May 29 19:03:25 2019 -0600 @@ -109,8 +109,34 @@ return Io.stdin end + +local function new_LuanUrl(io) + local this = new_LuanIn(io) + + local function check() + io.httpCon or error "must open first" + end + + function this.get_header(name) + check() + return io.httpCon.getHeaderField(name) + end + + function this.get_response_code() + check() + return io.httpCon.getResponseCode() + end + + function this.get_response_message() + check() + return io.httpCon.getResponseMessage() + end + + return this +end + local function url(path,options) - return new_LuanIn( LuanUrl.new(URL.new(path),options) ) + return new_LuanUrl( LuanUrl.new(URL.new(path),options) ) end function schemes.http(path,options)