Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
46
services/ota_update_go/handlers/experiment.go
Normal file
46
services/ota_update_go/handlers/experiment.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// HandleExperiment godoc
|
||||
// @Summary Testing msg preview
|
||||
// @Description Blank
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id query string true "ID of request"
|
||||
// @Router /experiment [get]
|
||||
func HandleExperiment(w http.ResponseWriter, r *http.Request) {
|
||||
// Get the "id" query parameter
|
||||
id := r.URL.Query().Get("id")
|
||||
if id == "" {
|
||||
http.Error(w, "missing id parameter", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Build Open Graph tags dynamically
|
||||
title := fmt.Sprintf("Page for ID %s", id)
|
||||
url := fmt.Sprintf("https://dev-gw.cloud.fiskerinc.com/ota_update/expirment?id=%s", id)
|
||||
image := "https://www.google.com/url?sa=i&url=https%3A%2F%2Fulife.vpul.upenn.edu%2Fcareerservices%2Fblog%2F2010%2F11%2F12%2Fprofessionalism-and-the-pre-health-student-beyond-please-and-thank-you%2Ffunny-cat-green-avacado%2F&psig=AOvVaw3bK13MXk_hL91SyLrmdrMS&ust=1755886127191000&source=images&cd=vfe&opi=89978449&ved=0CBYQjRxqFwoTCODu-du_nI8DFQAAAAAdAAAAABAE"
|
||||
|
||||
// Write headers
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
fmt.Fprintf(w, `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>%s</title>
|
||||
<meta property="og:title" content="%s" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="%s" />
|
||||
<meta property="og:image" content="%s" />
|
||||
<meta property="og:description" content="This is the Open Graph preview for ID %s" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Open Graph Page for %s</h1>
|
||||
<p>Preview metadata has been set in the HTML headers.</p>
|
||||
</body>
|
||||
</html>`, title, title, url, image, id, id)
|
||||
}
|
||||
Reference in New Issue
Block a user