Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

sailorproject / sailor / 417

25 Aug 2016 - 12:08 coverage increased (+0.5%) to 83.333%
417

Pull #125

travis-ci

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
refactor(ES): Move logic to controller
Pull Request #125: GSoc 2016: Admin console and Elasticsearch Integration (WIP)

56 of 56 new or added lines in 2 files covered. (100.0%)

27 existing lines in 3 files now uncovered.

1100 of 1320 relevant lines covered (83.33%)

398.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.59
/src/sailor/cookie.lua
1
--------------------------------------------------------------------------------
2
-- cookie.lua, v1.1: lib for cookies
3
-- This file is a part of Sailor project
4
-- Copyright (c) 2014 Etiene Dalcol <dalcol@etiene.net>
5
-- License: MIT
6
-- http://sailorproject.org
7
--------------------------------------------------------------------------------
8

9
local cookie = {}
9×
10
local remy = require "remy"
9×
11

12
function cookie.set(r, key, value, path)
9×
13
        path = path or "/"
9×
14
        if remy.detect(r) == remy.MODE_CGILUA then
12×
15
                local ck = require "cgilua.cookies"
!
16
                return ck.set(key,value,{path=path})
!
17
        end
18
        r.headers_out['Set-Cookie'] = ("%s=%s;Path=%s;"):format(key, value, path)
9×
19
end
20

21
function cookie.get(r, key)
9×
22
        local remy_mode = remy.detect(r)
36×
23
        if remy_mode == remy.MODE_CGILUA then
36×
24
                local ck = require "cgilua.cookies"
!
UNCOV
25
                return ck.get(key)
!
26
        elseif remy_mode == remy.MODE_LWAN then
36×
UNCOV
27
                return r.native_request:cookie(key)
!
28
        end
29
        return (r.headers_in['Cookie'] or ""):match(key .. "=([^;]+)") or ""
36×
30
end
31

32
return cookie
9×
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2022 Coveralls, Inc