Skip to content

Chapter3_headers_cookies_02.py calling from automatic docs forces user-agent entry that is ignored #7

@gitgithan

Description

@gitgithan

The book demonstrates calling using httpie, so i wanted to test calling from the docs page since it provides convenience in

  • formatting inputs
  • automatically handling trailing slashes
  • turns id into query parameter if forgot to add it as path parameter in chapter5_function_dependency_03

However I am unable to leave it empty. If i type gibberish, then it gives in response

{
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...
}

Question
Where is the validation on the docs defined? It seems like a separate system from fastapi?
When things like Query(...,ge=0) are defined and you enter -1, the docs do not even allow Execute to be clicked, showing a red background in the textbox. What is causing this?
I also noticed in chapter5_function_dependency_02 if skip: int = Query(0, ge=0) was changed to skip: int = Query(0, gt=0), minimum: 0 will disappear from the docs, how does this happen?

What is the difference between calling from httpie, docs or other tools?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions