(f filters.FilterContext)
| 627 | } |
| 628 | |
| 629 | func setStateBag(f filters.FilterContext) func(*lua.LState) int { |
| 630 | return func(s *lua.LState) int { |
| 631 | fld := s.ToString(-2) |
| 632 | val := s.Get(-1) |
| 633 | var res interface{} |
| 634 | switch val.Type() { |
| 635 | case lua.LTString: |
| 636 | res = string(val.(lua.LString)) |
| 637 | case lua.LTNumber: |
| 638 | res = float64(val.(lua.LNumber)) |
| 639 | case lua.LTTable: |
| 640 | res = val // store *lua.LTable as is |
| 641 | default: |
| 642 | // TODO(sszuecs): https://github.com/zalando/skipper/issues/1487 |
| 643 | // s.RaiseError("unsupported state bag value type %v, need a string or a number", val.Type()) |
| 644 | return 0 |
| 645 | } |
| 646 | f.StateBag()[fld] = res |
| 647 | return 0 |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | func getRequestHeader(f filters.FilterContext) func(*lua.LState) int { |
| 652 | return func(s *lua.LState) int { |
no test coverage detected
searching dependent graphs…