Merge pull request #884 from YunoHost/enh_ynh_local_curl_with_cookies

Persist cookies between multiple ynh_local_curl calls for the same app
This commit is contained in:
Bram 2020-03-10 18:34:10 +01:00 committed by GitHub
commit caa20e7b6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,6 +198,7 @@ ynh_setup_source () {
} }
# Curl abstraction to help with POST requests to local pages (such as installation forms) # Curl abstraction to help with POST requests to local pages (such as installation forms)
# For multiple calls, cookies are persisted between each call for the same app
# #
# $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?)) # $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?))
# #
@ -238,7 +239,7 @@ ynh_local_curl () {
sleep 2 sleep 2
# Curl the URL # Curl the URL
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar /tmp/ynh-$app-cookie.txt --cookie /tmp/ynh-$app-cookie.txt
} }
# Render templates with Jinja2 # Render templates with Jinja2