📝 docs: add ADR for staged-only Git hooks formatting
- Add ADR-0012 documenting the decision to format only staged Go files - Update ADR README.md with new entry - Document rationale, alternatives, and verification results - Include future considerations for monitoring and CI/CD integration Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -23,7 +23,7 @@ func NewClient(server *Server) *Client {
|
||||
|
||||
func (c *Client) Request(method, path string, body interface{}) error {
|
||||
url := c.server.GetBaseURL() + path
|
||||
|
||||
|
||||
var reqBody io.Reader
|
||||
if body != nil {
|
||||
// Handle different body types
|
||||
@@ -42,12 +42,12 @@ func (c *Client) Request(method, path string, body interface{}) error {
|
||||
return fmt.Errorf("unsupported body type: %T", body)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
req, err := http.NewRequest(method, url, reqBody)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Set content type for JSON bodies
|
||||
if body != nil && reqBody != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
@@ -70,7 +70,7 @@ func (c *Client) Request(method, path string, body interface{}) error {
|
||||
|
||||
func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Response, error) {
|
||||
url := c.server.GetBaseURL() + path
|
||||
|
||||
|
||||
var reqBody io.Reader
|
||||
if body != nil {
|
||||
// Handle different body types
|
||||
@@ -89,12 +89,12 @@ func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Res
|
||||
return nil, fmt.Errorf("unsupported body type: %T", body)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
req, err := http.NewRequest(method, url, reqBody)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Set content type for JSON bodies
|
||||
if body != nil && reqBody != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
@@ -104,7 +104,7 @@ func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Res
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("request failed: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Don't close the body here - let the caller handle it
|
||||
c.lastResp = resp
|
||||
c.lastBody, err = io.ReadAll(resp.Body)
|
||||
@@ -123,7 +123,7 @@ func (c *Client) ExpectResponseBody(expected string) error {
|
||||
actual := string(c.lastBody)
|
||||
// Trim trailing newline if present (common in JSON responses)
|
||||
actual = strings.TrimSuffix(actual, "\n")
|
||||
|
||||
|
||||
if actual != expected {
|
||||
return fmt.Errorf("expected response body %q, got %q", expected, actual)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user