Restconf: Support for list of media in Accept:
Restconf: Better RFC compliance with Accept errors: 406 vs 415 Fixed: [RESTCONF exit on cert error + complex accept](https://github.com/clicon/clixon/issues/551)
This commit is contained in:
parent
19c11eabb7
commit
c1ea72bcb3
14 changed files with 173 additions and 80 deletions
|
|
@ -205,7 +205,19 @@ EOF
|
|||
|
||||
new "WWW get index.html"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html)" 0 "HTTP/$HVER 200" "Content-Type: text/html" "<title>Welcome to Clixon!</title>"
|
||||
|
||||
|
||||
new "List of medias"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html,*/*' $proto://localhost/data/index.html)" 0 "HTTP/$HVER 200" "Content-Type: text/html" "<title>Welcome to Clixon!</title>"
|
||||
|
||||
new "List of medias2"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: wrong/media,*/*' $proto://localhost/data/index.html)" 0 "HT
|
||||
TP/$HVER 200" "Content-Type: text/html" "<title>Welcome to Clixon!</title>"
|
||||
|
||||
if false; then # XXX Se step 5 in api_http_data, unclear which media should be accepted
|
||||
new "Server does not support list of medias Expect 406"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: wrong/media' $proto://localhost/data/index.html)" 0 "HTTP/$HVER 406" "content-type: text/html" "<error-message>Unacceptable output encoding</error-message>"
|
||||
fi
|
||||
|
||||
new "WWW get dir -> expect index.html"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data)" 0 "HTTP/$HVER 200" "Content-Type: text/html" "<title>Welcome to Clixon!</title>"
|
||||
|
||||
|
|
@ -259,7 +271,7 @@ EOF
|
|||
expectpart "$(${netcat} 127.0.0.1 80 <<EOF
|
||||
GET /data/../../outside.html HTTP/1.1
|
||||
Host: localhost
|
||||
Accept: text_html
|
||||
Accept: text/html
|
||||
|
||||
EOF
|
||||
)" 0 "HTTP/1.1 403" "Forbidden"
|
||||
|
|
|
|||
|
|
@ -293,6 +293,9 @@ EOF
|
|||
new "limited invalid cert"
|
||||
expectpart "$(curl $CURLOPTS --key $certdir/limited.key --cert $certdir/limited.crt -X GET $RCPROTO://localhost/restconf/data/example:x 2>&1)" 0 "HTTP/$HVER 400" "\"error-message\": \"HTTP cert verification failed: certificate has expired"
|
||||
|
||||
# https://github.com/clicon/clixon/issues/551
|
||||
new "limited invalid cert, multiple media"
|
||||
expectpart "$(curl $CURLOPTS --key $certdir/limited.key --cert $certdir/limited.crt -H "Accept: application/yang-data+xml,*/*" -X GET $RCPROTO://localhost/restconf/data/example:x 2>&1)" 0 "HTTP/$HVER 400" "<error-message>HTTP cert verification failed: certificate has expired"
|
||||
new "limited invalid cert, xml"
|
||||
expectpart "$(curl $CURLOPTS --key $certdir/limited.key --cert $certdir/limited.crt -H "Accept: application/yang-data+xml" -X GET $RCPROTO://localhost/restconf/data/example:x 2>&1)" 0 "HTTP/$HVER 400" "<error-message>HTTP cert verification failed: certificate has expired"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue