clavitor/clavis/clavis-vault/api/mappings.go

19 lines
521 B
Go

package api
import (
_ "embed"
"net/http"
)
//go:embed importer-mappings.json
var importerMappingsJSON []byte
// HandleMappings serves the importer field mappings JSON to the browser.
// All import parsing happens client-side; this endpoint exists only to
// give the JS parsers their format spec.
func (h *Handlers) HandleMappings(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Cache-Control", "public, max-age=3600")
w.Write(importerMappingsJSON)
}