HTTP method for a Spring/JAX-RS style annotation name (e.g. "GetMapping" → * "GET", "RequestMapping" → "ANY", JAX-RS "GET" → "GET"). Returns NULL when the * annotation is not a route-mapping annotation. */
| 1273 | * "GET", "RequestMapping" → "ANY", JAX-RS "GET" → "GET"). Returns NULL when the |
| 1274 | * annotation is not a route-mapping annotation. */ |
| 1275 | static const char *annotation_route_method(const char *name) { |
| 1276 | if (!name) { |
| 1277 | return NULL; |
| 1278 | } |
| 1279 | if (strcmp(name, "GetMapping") == 0) { |
| 1280 | return "GET"; |
| 1281 | } |
| 1282 | if (strcmp(name, "PostMapping") == 0) { |
| 1283 | return "POST"; |
| 1284 | } |
| 1285 | if (strcmp(name, "PutMapping") == 0) { |
| 1286 | return "PUT"; |
| 1287 | } |
| 1288 | if (strcmp(name, "DeleteMapping") == 0) { |
| 1289 | return "DELETE"; |
| 1290 | } |
| 1291 | if (strcmp(name, "PatchMapping") == 0) { |
| 1292 | return "PATCH"; |
| 1293 | } |
| 1294 | if (strcmp(name, "RequestMapping") == 0) { |
| 1295 | return "ANY"; |
| 1296 | } |
| 1297 | /* JAX-RS bare-verb annotations (@GET/@POST/...) — path comes from @Path. */ |
| 1298 | if (strcmp(name, "GET") == 0 || strcmp(name, "POST") == 0 || strcmp(name, "PUT") == 0 || |
| 1299 | strcmp(name, "DELETE") == 0 || strcmp(name, "PATCH") == 0) { |
| 1300 | return name; |
| 1301 | } |
| 1302 | return NULL; |
| 1303 | } |
| 1304 | |
| 1305 | /* Extract route path + method from a decorator's AST nodes. |
| 1306 | * Works for: @app.route("/path"), @router.post("/path"), @GetMapping("/path"), |
no outgoing calls
no test coverage detected