tisonkun commented on code in PR #883:
URL: https://github.com/apache/pulsar-client-go/pull/883#discussion_r1023500127
##########
oauth2/client_credentials_provider.go:
##########
@@ -55,8 +56,17 @@ func (k *KeyFileProvider) GetClientCredentials() (*KeyFile,
error) {
case strings.HasPrefix(k.KeyFile, FILE):
filename := strings.TrimPrefix(k.KeyFile, FILE)
keyFile, err = ioutil.ReadFile(filename)
- case strings.HasPrefix(k.KeyFile, "data://"):
+ case strings.HasPrefix(k.KeyFile, DATA):
keyFile = []byte(strings.TrimPrefix(k.KeyFile, DATA))
+ case strings.HasPrefix(k.KeyFile, "data:"):
+ url, err := newDataURL(k.KeyFile)
+ if err != nil {
+ return nil, err
+ }
+ if url.Mimetype != "application/json" {
Review Comment:
Shall we relax the restriction here but let the following `json.Unmarshal`
to throw error so we tolerate the case that users don't specify `Mimetype` but
actually parse a valid JSON payload?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]