Fix dns_nederhost to work correctly with wget instead of curl.

The dns_nederhost DNS API relies on the exact HTTP status code to be
returned (e.g.  204); however, the _get function always returns 200 for a
succesful call when using wget instead of curl.  This patch fixes this by
using the _post function for all requests done by dns_nederhost.
This commit is contained in:
Sebastiaan Hoogeveen 2022-05-16 14:27:24 +02:00 committed by Sebastiaan Hoogeveen
parent a551619de6
commit 5ba2068fc2

View File

@ -112,12 +112,8 @@ _nederhost_rest() {
export _H1="Authorization: Bearer $NederHost_Key" export _H1="Authorization: Bearer $NederHost_Key"
export _H2="Content-Type: application/json" export _H2="Content-Type: application/json"
if [ "$m" != "GET" ]; then
_debug data "$data" _debug data "$data"
response="$(_post "$data" "$NederHost_Api/$ep" "" "$m")" response="$(_post "$data" "$NederHost_Api/$ep" "" "$m")"
else
response="$(_get "$NederHost_Api/$ep")"
fi
_code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\\r\\n")" _code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\\r\\n")"
_debug "http response code $_code" _debug "http response code $_code"