diff --git a/openapi/tests/file/file_test.go b/openapi/tests/file/file_test.go index a543b374..4774c5cb 100644 --- a/openapi/tests/file/file_test.go +++ b/openapi/tests/file/file_test.go @@ -164,7 +164,9 @@ func TestFileUpload(t *testing.T) { assert.Contains(t, response, "path") assert.Contains(t, response, "user_path") assert.Equal(t, testFileName, response["filename"]) - assert.Equal(t, testContentType, response["content_type"]) + // Content type may include charset + contentType, _ := response["content_type"].(string) + assert.True(t, strings.HasPrefix(contentType, testContentType), "Content-Type should start with %s, got %s", testContentType, contentType) assert.Equal(t, "uploaded", response["status"]) // The file_id should be URL-safe (no slashes) and be an MD5 hash (32 chars) @@ -519,7 +521,9 @@ func TestFileRetrieve(t *testing.T) { assert.Contains(t, response, "content_type") assert.Equal(t, testFileID, response["file_id"]) assert.Equal(t, testFileName, response["filename"]) - assert.Equal(t, testContentType, response["content_type"]) + // Content type may include charset + contentType, _ := response["content_type"].(string) + assert.True(t, strings.HasPrefix(contentType, testContentType), "Content-Type should start with %s, got %s", testContentType, contentType) t.Logf("Successfully retrieved file metadata: %s", testFileID) }) @@ -627,7 +631,9 @@ func TestFileContent(t *testing.T) { defer resp.Body.Close() assert.Equal(t, http.StatusOK, resp.StatusCode) - assert.Equal(t, testContentType, resp.Header.Get("Content-Type")) + // Content type may include charset + assert.True(t, strings.HasPrefix(resp.Header.Get("Content-Type"), testContentType), + "Content-Type should start with %s, got %s", testContentType, resp.Header.Get("Content-Type")) // Read and verify content content, err := io.ReadAll(resp.Body)