| 765 | |
| 766 | @pytest.mark.respx(base_url=base_url) |
| 767 | def test_binary_content_upload(self, respx_mock: MockRouter, client: OpenAI) -> None: |
| 768 | respx_mock.post(class="st">"/upload").mock(side_effect=mirror_request_content) |
| 769 | |
| 770 | file_content = bclass="st">"Hello, this is a test file." |
| 771 | |
| 772 | response = client.post( |
| 773 | class="st">"/upload", |
| 774 | content=file_content, |
| 775 | cast_to=httpx.Response, |
| 776 | options={class="st">"headers": {class="st">"Content-Type": class="st">"application/octet-stream"}}, |
| 777 | ) |
| 778 | |
| 779 | assert response.status_code == 200 |
| 780 | assert response.request.headers[class="st">"Content-Type"] == class="st">"application/octet-stream" |
| 781 | assert response.content == file_content |
| 782 | |
| 783 | def test_binary_content_upload_with_iterator(self) -> None: |
| 784 | file_content = bclass="st">"Hello, this is a test file." |