MXS-1220: Return 204 No Content for PUT and POST request

Returning 204 No Content removes the cost of always sending back the
modified resource. If the modified resource is required, a GET request
should be made to retrieve it.

Updated tests to account for this change.
This commit is contained in:
Markus Mäkelä
2017-05-06 08:37:19 +03:00
parent a384665141
commit efc5461daa
3 changed files with 37 additions and 20 deletions

View File

@ -34,3 +34,21 @@ static inline std::string http_get_date()
return std::string(buf);
}
/**
* @brief Convert a time_t value into a HTTP-date string
*
* @param t Time to convert
*
* @return The time converted to a HTTP-date string
*/
static inline std::string http_to_date(time_t t)
{
struct tm tm;
char buf[200]; // Enough to store all dates
gmtime_r(&t, &tm);
strftime(buf, sizeof(buf), "%a, %d %b %y %T GMT", &tm);
return std::string(buf);
}