Skip to content

Commit

Permalink
POST request on / endpoint returns key instead the url
Browse files Browse the repository at this point in the history
  • Loading branch information
SparrowSurya committed Sep 1, 2024
1 parent f37abc2 commit ca1f8db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def create_paste(paste: schemas.Paste, db: Session = Depends(get_db)):
logger.exception(error)
raise HTTPException(status_code=500, detail=str(error))

url = get_settings().base_url + f"/{db_paste.key}"
return url
return db_paste.key


@app.get("/{key}", response_model=schemas.PasteInfo)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def test_create_and_get_paste(self):
expire_date = datetime.datetime.now() + datetime.timedelta(seconds=expire_after)

response = self.client.post("/", json=json_request)
url = response.json()
_, key = url.split("/")
key = response.json()

self.assertEqual(response.status_code, 200)
self.assertEqual(len(key), 4)
Expand Down

0 comments on commit ca1f8db

Please sign in to comment.