@@ -927,13 +927,13 @@ func (client *NginxClient) getIDOfHTTPServer(upstream string, name string) (int,
927
927
}
928
928
929
929
func (client * NginxClient ) get (path string , data interface {}) error {
930
- return client .getWithContext (context .Background (), path , data )
930
+ timeoutCtx , cancel := context .WithTimeout (context .Background (), client .ctxTimeout )
931
+ defer cancel ()
932
+
933
+ return client .getWithContext (timeoutCtx , path , data )
931
934
}
932
935
933
936
func (client * NginxClient ) getWithContext (ctx context.Context , path string , data interface {}) error {
934
- ctx , cancel := context .WithTimeout (ctx , client .ctxTimeout )
935
- defer cancel ()
936
-
937
937
url := fmt .Sprintf ("%v/%v/%v" , client .apiEndpoint , client .apiVersion , path )
938
938
939
939
req , err := http .NewRequestWithContext (ctx , http .MethodGet , url , nil )
@@ -965,13 +965,13 @@ func (client *NginxClient) getWithContext(ctx context.Context, path string, data
965
965
}
966
966
967
967
func (client * NginxClient ) post (path string , input interface {}) error {
968
- return client .postWithContext (context .Background (), path , input )
968
+ timeoutCtx , cancel := context .WithTimeout (context .Background (), client .ctxTimeout )
969
+ defer cancel ()
970
+
971
+ return client .postWithContext (timeoutCtx , path , input )
969
972
}
970
973
971
974
func (client * NginxClient ) postWithContext (ctx context.Context , path string , input interface {}) error {
972
- ctx , cancel := context .WithTimeout (ctx , client .ctxTimeout )
973
- defer cancel ()
974
-
975
975
url := fmt .Sprintf ("%v/%v/%v" , client .apiEndpoint , client .apiVersion , path )
976
976
977
977
jsonInput , err := json .Marshal (input )
@@ -1001,13 +1001,13 @@ func (client *NginxClient) postWithContext(ctx context.Context, path string, inp
1001
1001
}
1002
1002
1003
1003
func (client * NginxClient ) delete (path string , expectedStatusCode int ) error {
1004
- return client .deleteWithContext (context .Background (), path , expectedStatusCode )
1004
+ timeoutCtx , cancel := context .WithTimeout (context .Background (), client .ctxTimeout )
1005
+ defer cancel ()
1006
+
1007
+ return client .deleteWithContext (timeoutCtx , path , expectedStatusCode )
1005
1008
}
1006
1009
1007
1010
func (client * NginxClient ) deleteWithContext (ctx context.Context , path string , expectedStatusCode int ) error {
1008
- ctx , cancel := context .WithTimeout (ctx , client .ctxTimeout )
1009
- defer cancel ()
1010
-
1011
1011
path = fmt .Sprintf ("%v/%v/%v/" , client .apiEndpoint , client .apiVersion , path )
1012
1012
1013
1013
req , err := http .NewRequestWithContext (ctx , http .MethodDelete , path , nil )
@@ -1030,13 +1030,13 @@ func (client *NginxClient) deleteWithContext(ctx context.Context, path string, e
1030
1030
}
1031
1031
1032
1032
func (client * NginxClient ) patch (path string , input interface {}, expectedStatusCode int ) error {
1033
- return client .patchWithContext (context .Background (), path , input , expectedStatusCode )
1033
+ timeoutCtx , cancel := context .WithTimeout (context .Background (), client .ctxTimeout )
1034
+ defer cancel ()
1035
+
1036
+ return client .patchWithContext (timeoutCtx , path , input , expectedStatusCode )
1034
1037
}
1035
1038
1036
1039
func (client * NginxClient ) patchWithContext (ctx context.Context , path string , input interface {}, expectedStatusCode int ) error {
1037
- ctx , cancel := context .WithTimeout (ctx , client .ctxTimeout )
1038
- defer cancel ()
1039
-
1040
1040
path = fmt .Sprintf ("%v/%v/%v/" , client .apiEndpoint , client .apiVersion , path )
1041
1041
1042
1042
jsonInput , err := json .Marshal (input )
0 commit comments