You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First things first, smocker is dead simple to start with, keep up the good work!
Lately, I wanted to avoid putting a large piece of JSON directly in a mock definition so I tried to offload it to another file and read it from a Lua's script this way (I am not fluent in Lua by the way):
- request:
method: GETpath: /data/666dynamic_response:
engine: luascript: > local io = require("io") local file = io.open("/data/666.json", "rb") if not file then return nil end local content = file:read "*a" file:close() return { body = content, headers = { ["Content-Type"] = {"application/json"} } }
But this fails because it cannot find io (whether I put a require or not).
At first I was wondering if GopherLua even supported file operations but this issue seems to confirm that this is the case.
May anyone shed some light on this particular point?
The text was updated successfully, but these errors were encountered:
Hello,
First things first, smocker is dead simple to start with, keep up the good work!
Lately, I wanted to avoid putting a large piece of JSON directly in a mock definition so I tried to offload it to another file and read it from a Lua's script this way (I am not fluent in Lua by the way):
But this fails because it cannot find
io
(whether I put arequire
or not).At first I was wondering if GopherLua even supported file operations but this issue seems to confirm that this is the case.
May anyone shed some light on this particular point?
The text was updated successfully, but these errors were encountered: