Compare commits
No commits in common. "27a8c3d1d1d534f8744e0397ff37e2cc25ec38c5" and "459d10664a33bc5942a1bc56e92a7fa79db69bff" have entirely different histories.
27a8c3d1d1
...
459d10664a
1 changed files with 2 additions and 6 deletions
|
@ -58,7 +58,7 @@ func handler(ctx *fasthttp.RequestCtx) {
|
||||||
)
|
)
|
||||||
|
|
||||||
row := stmt.QueryRow(
|
row := stmt.QueryRow(
|
||||||
string(ctx.Method()),
|
ctx.Method(),
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"%s://%s:%s%s",
|
"%s://%s:%s%s",
|
||||||
scheme,
|
scheme,
|
||||||
|
@ -72,13 +72,9 @@ func handler(ctx *fasthttp.RequestCtx) {
|
||||||
var code int
|
var code int
|
||||||
|
|
||||||
err := row.Scan(&id, &code)
|
err := row.Scan(&id, &code)
|
||||||
if err == sql.ErrNoRows {
|
if err != nil {
|
||||||
ctx.Response.SetStatusCode(404)
|
ctx.Response.SetStatusCode(404)
|
||||||
return
|
return
|
||||||
} else if err != nil {
|
|
||||||
ctx.Response.SetStatusCode(500)
|
|
||||||
ctx.Response.SetBodyString("Unable to fetch row: " + err.Error())
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- set status code
|
// -- set status code
|
||||||
|
|
Loading…
Add table
Reference in a new issue