Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update /api/delete to use POST method instead of DELETE #376

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ollama/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def list(self) -> ListResponse:

def delete(self, model: str) -> StatusResponse:
r = self._request_raw(
'DELETE',
'POST',
'/api/delete',
json=DeleteRequest(
model=model,
Expand Down Expand Up @@ -1080,7 +1080,7 @@ async def list(self) -> ListResponse:

async def delete(self, model: str) -> StatusResponse:
r = await self._request_raw(
'DELETE',
'POST',
'/api/delete',
json=DeleteRequest(
model=model,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def test_client_create_blob_exists(httpserver: HTTPServer):


def test_client_delete(httpserver: HTTPServer):
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='DELETE').respond_with_response(Response(status=200))
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='POST').respond_with_response(Response(status=200))
client = Client(httpserver.url_for('/api/delete'))
response = client.delete('dummy')
assert response['status'] == 'success'
Expand Down Expand Up @@ -1179,7 +1179,7 @@ async def test_async_client_create_blob_exists(httpserver: HTTPServer):

@pytest.mark.asyncio
async def test_async_client_delete(httpserver: HTTPServer):
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='DELETE').respond_with_response(Response(status=200))
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='POST').respond_with_response(Response(status=200))
client = AsyncClient(httpserver.url_for('/api/delete'))
response = await client.delete('dummy')
assert response['status'] == 'success'
Expand Down