mirror of
				https://github.com/containers/podman.git
				synced 2025-11-04 17:07:20 +08:00 
			
		
		
		
	Add Server header to API service responses
Aids in reading logs of different services Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
		@ -40,9 +40,12 @@ func (s *APIServer) APIHandler(h http.HandlerFunc) http.HandlerFunc {
 | 
				
			|||||||
			c = context.WithValue(c, "idletracker", s.idleTracker)    // nolint
 | 
								c = context.WithValue(c, "idletracker", s.idleTracker)    // nolint
 | 
				
			||||||
			r = r.WithContext(c)
 | 
								r = r.WithContext(c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			v := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion]
 | 
								cv := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion]
 | 
				
			||||||
			w.Header().Set("API-Version", fmt.Sprintf("%d.%d", v.Major, v.Minor))
 | 
								w.Header().Set("API-Version", fmt.Sprintf("%d.%d", cv.Major, cv.Minor))
 | 
				
			||||||
			w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String())
 | 
					
 | 
				
			||||||
 | 
								lv := utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String()
 | 
				
			||||||
 | 
								w.Header().Set("Libpod-API-Version", lv)
 | 
				
			||||||
 | 
								w.Header().Set("Server", "Libpod/"+lv+" ("+runtime.GOOS+")")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			h(w, r)
 | 
								h(w, r)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user