networking · beginner · ~15 min

Valid HTTP method?

Validate against the common HTTP methods.

Challenge

Implement int is_http_method(const char *m) returning 1 for GET, POST, PUT, DELETE, HEAD, else 0.

Starter code

#include <string.h>

int is_http_method(const char *m) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.