Trailing Slash 란?

헨도·2023년 1월 7일
0

FastAPI

목록 보기
7/8
post-thumbnail

FastAPI

trailing slash 란?

URL 뒤에 붙는 슬래쉬를 "trailing slash" 라고 부른다.
엔드 포인트 뒤에 슬래쉬를 붙인 것과 붙이지 않은 주소는 다른 주소이다.

@app.get("/users/")
def get_users(limit : int) :
	return {"limit" : limit}
>>> http :8000/users/?limit=1
{
	"limit" : 1
}

붙인 것과 붙이지 않은 주소는 다르지만, redirect를 해준다.

>>> http :8000/users?limit=1
307 Temporary Redirect Transfer-Encoding
profile
Junior Backend Developer

0개의 댓글