Mercurial
comparison seobeo/s_router.c @ 78:e7bf9e002850
amend
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 31 Dec 2025 15:07:43 -0800 |
| parents | 4532ce6d9eb8 |
| children | 5710108c949e |
comparison
equal
deleted
inserted
replaced
| 77:c348ac875294 | 78:e7bf9e002850 |
|---|---|
| 16 | 16 |
| 17 static Seobeo_Route *g_routes = NULL; | 17 static Seobeo_Route *g_routes = NULL; |
| 18 | 18 |
| 19 void Seobeo_Router_Init() | 19 void Seobeo_Router_Init() |
| 20 { | 20 { |
| 21 g_routes = NULL; | 21 Dowa_Array_Reserve(g_routes, 20); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler) | 24 void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler) |
| 25 { | 25 { |
| 26 Seobeo_Route route = {0}; | 26 Seobeo_Route route = {0}; |
| 142 { | 142 { |
| 143 body = ((Seobeo_Request_Entry*)p_body_kv)->value; | 143 body = ((Seobeo_Request_Entry*)p_body_kv)->value; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Default text plain | 146 // Default text plain |
| 147 const char *content_type = "text/plain"; | 147 const char *content_type = "text/html"; |
| 148 void *p_content_type_kv = Dowa_HashMap_Get_Ptr(p_response_map, "content-type"); | 148 void *p_content_type_kv = Dowa_HashMap_Get_Ptr(p_response_map, "content-type"); |
| 149 if (p_content_type_kv) | 149 if (p_content_type_kv) |
| 150 { | 150 { |
| 151 content_type = ((Seobeo_Request_Entry*)p_content_type_kv)->value; | 151 content_type = ((Seobeo_Request_Entry*)p_content_type_kv)->value; |
| 152 } | 152 } |