Skip to content

Commit

Permalink
(feat) allow setting headers via the api
Browse files Browse the repository at this point in the history
closes #143
  • Loading branch information
leonjza committed Jul 21, 2022
1 parent ad7a6af commit f5e2aea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/server.go
Expand Up @@ -589,7 +589,8 @@ func apiDetailScreenshotHandler(c *gin.Context) {
func apiScreenshotHandler(c *gin.Context) {

type Request struct {
URL string `json:"url"`
URL string `json:"url"`
Headers []string `json:"headers"`
// set oneshot to "true" if you just want to see the screenshot, and not add it to the report
OneShot string `json:"oneshot"`
}
Expand Down Expand Up @@ -623,6 +624,9 @@ func apiScreenshotHandler(c *gin.Context) {
}

// prepare request headers
if len(requestData.Headers) > 0 {
chrm.Headers = requestData.Headers
}
chrm.PrepareHeaderMap()

// deliver a oneshot screenshot to the user
Expand Down

0 comments on commit f5e2aea

Please sign in to comment.