MCPcopy
hub / github.com/apache/devlake / Write

Method Write

backend/server/api/api.go:213–225  ·  view source on GitHub ↗

Write intercepts the response body and modifies the base path

(b []byte)

Source from the content-addressed store, hash-verified

211
212// Write intercepts the response body and modifies the base path
213func (w bodyTamper) Write(b []byte) (int, error) {
214 var m map[string]interface{}
215 err := json.Unmarshal(b, &m)
216 if err != nil {
217 return 0, err
218 }
219 m["basePath"] = "/api"
220 b, err = json.Marshal(m)
221 if err != nil {
222 return 0, err
223 }
224 return w.ResponseWriter.Write(b)
225}
226
227func modifyBasePath(c *gin.Context) {
228 if !strings.HasSuffix(c.Request.URL.Path, "swagger/doc.json") {

Callers 3

toGzipFunction · 0.45
scanErrorPipeFunction · 0.45
UpMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected