Skip to content

[Bug] mobilenet example should only handle POST requests #10

@MortalHappiness

Description

@MortalHappiness

request = await http_request.form()
image_file = await request["image"].read()

Here it should reject all requests with method other than POST. Otherwise a KeyError will be raised like this:

Unexpected error, traceback: �[36mray::ServeReplica:mobilenet:ImageClassifier.handle_request_streaming()�[39m (pid=768, ip=10.244.0.18)
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/serve/_private/utils.py", line 165, in wrap_to_ray_error
    raise exception
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/serve/_private/replica.py", line 895, in call_user_method
    result = await method_to_call(*request_args, **request_kwargs)
  File "/tmp/ray/session_2024-08-23_21-13-49_235633_14/runtime_resources/working_dir_files/https_github_com_ray-project_serve_config_examples_archive_b393e77bbd6aba0881e3d94c05f968f05a387b96/mobilenet/mobilenet.py", line 25, in __call__
    image_file = await request["image"].read()
  File "/home/ray/anaconda3/lib/python3.8/site-packages/starlette/datastructures.py", line 310, in __getitem__
    return self._dict[key]
KeyError: 'image'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions