mirror of
https://github.com/georgyo/ifconfig.io.git
synced 2025-03-05 04:46:17 +00:00
FIX: json response for specific field endpoints
This commit is contained in:
parent
4c19dda3a6
commit
c82e3a5ff8
6
main.go
6
main.go
@ -154,7 +154,11 @@ func mainHandler(c *gin.Context) {
|
|||||||
c.String(404, "Not Found")
|
c.String(404, "Not Found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.String(200, fmt.Sprintln(fieldResult))
|
if wantsJSON {
|
||||||
|
c.JSON(200, fieldResult)
|
||||||
|
} else {
|
||||||
|
c.String(200, fmt.Sprintln(fieldResult))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user