Add log messages to GetUsers endpoint
This commit is contained in:
		
							parent
							
								
									5c76a4b1c3
								
							
						
					
					
						commit
						f33aef6e4a
					
				|  | @ -3,6 +3,8 @@ package users | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  | 	"io" | ||||||
|  | 	"log/slog" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/url" | 	"net/url" | ||||||
| 
 | 
 | ||||||
|  | @ -51,8 +53,14 @@ func (u *Users) GetUsers(ctx context.Context, params *GetUsersParams) (*GetUsers | ||||||
| 	} | 	} | ||||||
| 	defer res.Body.Close() | 	defer res.Body.Close() | ||||||
| 
 | 
 | ||||||
|  | 	body, err := io.ReadAll(res.Body) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	var data GetUsersResponse | 	var data GetUsersResponse | ||||||
| 	if err := json.NewDecoder(res.Body).Decode(&data); err != nil { | 	if err := json.Unmarshal(body, &data); err != nil { | ||||||
|  | 		slog.Debug("failed to unmarshal", "error", err, "body", string(body)) | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue