题目
FIT5032_S2_2025 Sample Quiz
单项选择题
A developer has implemented a custom API using Firebase Cloud Functions to serve specific data. This API is designed to handle GET requests for public data. A security audit flags a concern about how the API handles unsupported HTTP methods, such as a PUT request. According to best practices for API security and error handling, which response is the most appropriate when a PUT request is received at this GET-only endpoint?
选项
A.a. Return a 500 Internal Server Error, as an unexpected request method indicates a server-side problem.
B.b. Return a 200 OK status with an empty response body, as no data was modified.
C.c. Return a 405 Method Not Allowed status, explicitly indicating that the PUT method is not supported.
D.d. Return a 404 Not Found status, to avoid exposing internal logic about supported methods to potential attackers.

查看解析
标准答案
Please login to view
思路分析
Let’s break down what the question is asking: when a PUT request arrives at a GET-only endpoint, which response best aligns with API security and proper error handling practices?
Option a: Return a 500 Internal Server Error, as an unexpected request method indicates a server-side problem.
- This is not appropriate because an unsupported method is a normal, anticipated scenario, not a server fault. A 500 implies the server crashed or encountered an unexpected condition, whic......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
The HTTP method used to update an existing resource in REST is:
Which HTTP method is typically used for retrieving data in RESTful services?
Match the RESTful verbs with their correct definition below 1: GET 2: PUT 3: POST 4: DELETE
Question at position 4 POST requests are primarily used to retrieve data from the server without any side effects, while GET requests are used to submit data to the server, causing changes in state or updates to resources.POST requests are primarily used to retrieve data from the server without any side effects, while GET requests are used to submit data to the server, causing changes in state or updates to resources.TrueFalse
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!