@@ -34,6 +34,7 @@ var _ ServerInterface = (*apiServer)(nil)
34
34
35
35
func (a * apiServer ) AgentEnroll (w http.ResponseWriter , r * http.Request , params AgentEnrollParams ) {
36
36
zlog := hlog .FromRequest (r ).With ().Str ("mod" , kEnrollMod ).Logger ()
37
+ w .Header ().Set ("Content-Type" , "application/json" )
37
38
38
39
// Error in the scope for deferred rolback function check
39
40
var err error
@@ -60,6 +61,7 @@ func (a *apiServer) AgentEnroll(w http.ResponseWriter, r *http.Request, params A
60
61
61
62
func (a * apiServer ) AgentAcks (w http.ResponseWriter , r * http.Request , id string , params AgentAcksParams ) {
62
63
zlog := hlog .FromRequest (r ).With ().Str (LogAgentID , id ).Logger ()
64
+ w .Header ().Set ("Content-Type" , "application/json" )
63
65
if err := a .ack .handleAcks (zlog , w , r , id ); err != nil {
64
66
cntAcks .IncError (err )
65
67
ErrorResp (w , r , err )
@@ -68,6 +70,7 @@ func (a *apiServer) AgentAcks(w http.ResponseWriter, r *http.Request, id string,
68
70
69
71
func (a * apiServer ) AgentCheckin (w http.ResponseWriter , r * http.Request , id string , params AgentCheckinParams ) {
70
72
zlog := hlog .FromRequest (r ).With ().Str (LogAgentID , id ).Logger ()
73
+ w .Header ().Set ("Content-Type" , "application/json" )
71
74
err := a .ct .handleCheckin (zlog , w , r , id , params .UserAgent )
72
75
if err != nil {
73
76
cntCheckin .IncError (err )
@@ -84,13 +87,15 @@ func (a *apiServer) Artifact(w http.ResponseWriter, r *http.Request, id string,
84
87
85
88
err := a .at .handleArtifacts (zlog , w , r , id , sha2 )
86
89
if err != nil {
90
+ w .Header ().Set ("Content-Type" , "application/json" )
87
91
cntArtifacts .IncError (err )
88
92
ErrorResp (w , r , err )
89
93
}
90
94
}
91
95
92
96
func (a * apiServer ) UploadBegin (w http.ResponseWriter , r * http.Request , params UploadBeginParams ) {
93
97
zlog := hlog .FromRequest (r ).With ().Logger ()
98
+ w .Header ().Set ("Content-Type" , "application/json" )
94
99
err := a .ut .handleUploadBegin (zlog , w , r )
95
100
if err != nil {
96
101
cntUploadStart .IncError (err )
@@ -100,6 +105,7 @@ func (a *apiServer) UploadBegin(w http.ResponseWriter, r *http.Request, params U
100
105
101
106
func (a * apiServer ) UploadComplete (w http.ResponseWriter , r * http.Request , id string , params UploadCompleteParams ) {
102
107
zlog := hlog .FromRequest (r ).With ().Str (LogAgentID , id ).Logger ()
108
+ w .Header ().Set ("Content-Type" , "application/json" )
103
109
err := a .ut .handleUploadComplete (zlog , w , r , id )
104
110
if err != nil {
105
111
cntUploadEnd .IncError (err )
@@ -109,6 +115,7 @@ func (a *apiServer) UploadComplete(w http.ResponseWriter, r *http.Request, id st
109
115
110
116
func (a * apiServer ) UploadChunk (w http.ResponseWriter , r * http.Request , id string , chunkNum int , params UploadChunkParams ) {
111
117
zlog := hlog .FromRequest (r ).With ().Str (LogAgentID , id ).Logger ()
118
+ w .Header ().Set ("Content-Type" , "application/json" )
112
119
113
120
if _ , err := a .ut .authAPIKey (r , a .bulker , a .ut .cache ); err != nil {
114
121
cntUploadChunk .IncError (err )
@@ -125,6 +132,7 @@ func (a *apiServer) Status(w http.ResponseWriter, r *http.Request, params Status
125
132
zlog := hlog .FromRequest (r ).With ().
126
133
Str ("mod" , kStatusMod ).
127
134
Logger ()
135
+ w .Header ().Set ("Content-Type" , "application/json" )
128
136
err := a .st .handleStatus (zlog , a .sm , a .bi , r , w )
129
137
if err != nil {
130
138
cntStatus .IncError (err )
0 commit comments