@@ -2,6 +2,7 @@ package osnadmin
22
33import (
44 "bytes"
5+ "context"
56 "crypto/tls"
67 "crypto/x509"
78 "fmt"
@@ -10,18 +11,18 @@ import (
1011)
1112
1213// Update channel configuration using presented config envelope.
13- func Update (osnURL , channelID string , caCertPool * x509.CertPool , tlsClientCert tls.Certificate , configEnvelope []byte ) (* http.Response , error ) {
14+ func Update (ctx context. Context , osnURL , channelID string , caCertPool * x509.CertPool , tlsClientCert tls.Certificate , configEnvelope []byte ) (* http.Response , error ) {
1415 url := fmt .Sprintf ("%s/participation/v1/channels/%s" , osnURL , channelID )
1516
16- req , err := createUpdateRequest (url , configEnvelope )
17+ req , err := createUpdateRequest (ctx , url , configEnvelope )
1718 if err != nil {
1819 return nil , fmt .Errorf ("create update request: %w" , err )
1920 }
2021
2122 return httpDo (req , caCertPool , tlsClientCert )
2223}
2324
24- func createUpdateRequest (url string , configEnvelope []byte ) (* http.Request , error ) {
25+ func createUpdateRequest (ctx context. Context , url string , configEnvelope []byte ) (* http.Request , error ) {
2526 joinBody := new (bytes.Buffer )
2627 writer := multipart .NewWriter (joinBody )
2728 part , err := writer .CreateFormFile ("config-update-envelope" , "config_update.pb" )
@@ -37,7 +38,7 @@ func createUpdateRequest(url string, configEnvelope []byte) (*http.Request, erro
3738 return nil , err
3839 }
3940
40- req , err := http .NewRequest ( http .MethodPut , url , joinBody )
41+ req , err := http .NewRequestWithContext ( ctx , http .MethodPut , url , joinBody )
4142 if err != nil {
4243 return nil , err
4344 }
0 commit comments