Mercurial Hosting > luan
comparison http/src/luan/modules/http/Http_test.luan @ 572:f1601a4ce1aa
fix stack when calling meta-methods
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 12 Jul 2015 21:34:23 -0600 |
parents | cd944b010f25 |
children | 1e69d9c21461 |
comparison
equal
deleted
inserted
replaced
571:cd944b010f25 | 572:f1601a4ce1aa |
---|---|
1 local Luan = require "luan:Luan" | |
2 local error = Luan.error | |
3 local set_metatable = Luan.set_metatable or error() | |
1 local Io = require "luan:Io" | 4 local Io = require "luan:Io" |
2 local String = require "luan:String" | 5 local String = require "luan:String" |
3 local matches = String.matches | 6 local matches = String.matches or error() |
4 local Http = require "luan:http/Http" | 7 local Http = require "luan:http/Http" |
8 | |
5 | 9 |
6 local M = {} | 10 local M = {} |
7 | 11 |
8 M.welcome_file = "index.html" | 12 M.welcome_file = "index.html" |
9 M.cookie = {} | 13 M.cookie = {} |
25 Http.request.cookie = M.cookie | 29 Http.request.cookie = M.cookie |
26 | 30 |
27 Http.response = Http.new_response{ | 31 Http.response = Http.new_response{ |
28 | 32 |
29 text_writer = function() | 33 text_writer = function() |
30 Http.response.headers = nil | 34 set_metatable(Http.response.headers,M.sent_error_metatable) |
31 M.result = Io.uri "string:" | 35 M.result = Io.uri "string:" |
32 M.text_writer = M.result.text_writer() | 36 M.text_writer = M.result.text_writer() |
33 return M.text_writer | 37 return M.text_writer |
34 end; | 38 end; |
35 | 39 |