@@ -30,7 +30,7 @@ var cache1lock = sync.Mutex{}
3030
3131func NewClient (baseUrl string ) * Client {
3232 return NewClientWith (& Config {
33- Url : baseUrl ,
33+ Url : baseUrl ,
3434 LogLevel : LogNothing ,
3535 })
3636}
@@ -324,7 +324,7 @@ func (c *Client) registerSchemaUnderSubject(ctx context.Context, subject, schema
324324 return 0 , fmt .Errorf ("could not marshal schema registry request: %v" , err )
325325 }
326326 httpClient := c .getHttpClient ()
327- var u = fmt .Sprintf ("%s/subjects/%s/versions" , c .config .Url , url .PathEscape (subject ))
327+ var u = fmt .Sprintf ("%s/subjects/%s/versions" , c .config .Url , url .PathEscape (subject ))
328328 j := new (newSchemaResponse )
329329 req , err := http .NewRequest ("POST" , u , bytes .NewReader (jsonRequest ))
330330 if err != nil {
@@ -340,13 +340,14 @@ func (c *Client) registerSchemaUnderSubject(ctx context.Context, subject, schema
340340 if err != nil {
341341 return 0 , fmt .Errorf ("error while making a http request for registering a new schema: %v" , err )
342342 }
343- if resp .StatusCode != 200 {
344- return 0 , fmt .Errorf (resp .Status )
345- }
346343 data , err := ioutil .ReadAll (resp .Body )
347344 if err != nil {
348345 return 0 , fmt .Errorf ("error reading schema registry http response body: %v" , err )
349346 }
347+ if resp .StatusCode != 200 {
348+ return 0 , fmt .Errorf ("error reading schema registry, status: %s, body: %s" , resp .Status , string (data ))
349+ }
350+
350351 if err := json .Unmarshal (data , & j ); err != nil {
351352 return 0 , fmt .Errorf ("error unmarshaling schema registry response json: %v" , err )
352353 }
0 commit comments