kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit adef05147e4293fb0e13565919a051fa1b10201b
parent ca2837fbaf110dbe359aecc4f6f97b0a962e5576
Author: Joris Vink <joris@coders.se>
Date:   Mon, 21 Mar 2016 15:29:07 +0100

Merge pull request #116 from SDAIA/http_method_text

Adds http_method_text
Diffstat:
includes/http.h | 1+
src/http.c | 28++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/includes/http.h b/includes/http.h @@ -214,6 +214,7 @@ void http_init(void); void http_cleanup(void); void http_process(void); const char *http_status_text(int); +const char *http_method_text(int); time_t http_date_to_time(char *); void http_request_free(struct http_request *); void http_request_sleep(struct http_request *); diff --git a/src/http.c b/src/http.c @@ -1591,3 +1591,31 @@ http_status_text(int status) return (r); } + +const char * +http_method_text(int method) +{ + char *r; + switch(method) { + case HTTP_METHOD_GET: + r = "GET"; + break; + case HTTP_METHOD_POST: + r = "POST"; + break; + case HTTP_METHOD_PUT: + r = "PUT"; + break; + case HTTP_METHOD_DELETE: + r = "DELETE"; + break; + case HTTP_METHOD_HEAD: + r = "HEAD"; + break; + default: + r = ""; + break; + } + + return (r); +}