Add GET /issue/<issueId> API endpoint.
This commit is contained in:
parent
8b46cc19d8
commit
dc31d590a0
@ -94,6 +94,19 @@ proc start*(cfg: PitApiCfg) =
|
|||||||
post "/issues":
|
post "/issues":
|
||||||
checkAuth(cfg); if not authed: return true
|
checkAuth(cfg); if not authed: return true
|
||||||
|
|
||||||
|
get "/issue/@issueId":
|
||||||
|
checkAuth(cfg); if not authed: return true
|
||||||
|
|
||||||
|
var (hasColor, args) = paramsToArgs(request.params)
|
||||||
|
args = @["list", issueId] & args
|
||||||
|
|
||||||
|
info "args: \n" & args.join(" ")
|
||||||
|
let execResult = execWithOutput("pit", ".", args)
|
||||||
|
if execResult[2] != 0: resp(Http500, stripAnsi($execResult[0] & "\n" & $execResult[1]), TXT)
|
||||||
|
else:
|
||||||
|
if hasColor: resp(stripAnsi(execResult[0]), TXT)
|
||||||
|
else: resp(execResult[0], TXT)
|
||||||
|
|
||||||
waitFor(stopFuture)
|
waitFor(stopFuture)
|
||||||
|
|
||||||
proc loadApiConfig(args: Table[string, Value]): PitApiCfg =
|
proc loadApiConfig(args: Table[string, Value]): PitApiCfg =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user