comparison src/luan/modules/http/Http.luan @ 1237:275d1b52dbce

add Request.scheme
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 11 Jun 2018 18:22:51 -0600
parents b6aa2cd51b02
children beebd0f5f2ba
comparison
equal deleted inserted replaced
1236:5b9856045e51 1237:275d1b52dbce
28 function Http.new_request(java) 28 function Http.new_request(java)
29 local this = {} 29 local this = {}
30 Http.request = this 30 Http.request = this
31 if java == nil then 31 if java == nil then
32 this.method = "GET" 32 this.method = "GET"
33 this.scheme = "http"
33 this.headers = {} 34 this.headers = {}
34 this.parameters = {} 35 this.parameters = {}
35 this.cookies = {} 36 this.cookies = {}
36 else 37 else
37 this.java = java 38 this.java = java
38 this.raw_head = java.rawHead or error() 39 this.raw_head = java.rawHead or error()
39 this.method = java.method or error() 40 this.method = java.method or error()
40 this.raw_path = java.rawPath or error() 41 this.raw_path = java.rawPath or error()
41 this.path = java.path or error() 42 this.path = java.path or error()
42 this.protocol = java.protocol or error() 43 this.protocol = java.protocol or error()
44 this.scheme = java.scheme or error()
43 this.headers = JavaLuan.toLuan(java.headers) 45 this.headers = JavaLuan.toLuan(java.headers)
44 this.parameters = JavaLuan.toLuan(java.parameters) 46 this.parameters = JavaLuan.toLuan(java.parameters)
45 this.cookies = JavaLuan.toLuan(java.cookies) 47 this.cookies = JavaLuan.toLuan(java.cookies)
46 end 48 end
47 this.scheme = "http"
48 49
49 function this.url() 50 function this.url()
50 return this.scheme.."://"..this.headers["host"]..this.raw_path 51 return this.scheme.."://"..this.headers["host"]..this.raw_path
51 end 52 end
52 53