mirror of https://github.com/arendst/Tasmota.git
Berry add `wc.set_follow_redirects(bool)` (#18165)
This commit is contained in:
parent
c74c92baed
commit
4aa9aebae3
|
@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Extended Tariff command for forced tariff (#18080)
|
- Extended Tariff command for forced tariff (#18080)
|
||||||
- Berry support for Tensorflow Lite (TFL) by Christiaan Baars (#18119)
|
- Berry support for Tensorflow Lite (TFL) by Christiaan Baars (#18119)
|
||||||
- Zigbee send Tuya 'magic spell' to unlock devices when pairing (#18144)
|
- Zigbee send Tuya 'magic spell' to unlock devices when pairing (#18144)
|
||||||
|
- Berry add `wc.set_follow_redirects(bool)`
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Shelly Pro 4PM using standard MCP23xxx driver and needs one time Auto-Configuration
|
- Shelly Pro 4PM using standard MCP23xxx driver and needs one time Auto-Configuration
|
||||||
|
|
|
@ -14,6 +14,7 @@ extern int wc_urlencode(bvm *vm);
|
||||||
extern int wc_begin(bvm *vm);
|
extern int wc_begin(bvm *vm);
|
||||||
extern int wc_set_timeouts(bvm *vm);
|
extern int wc_set_timeouts(bvm *vm);
|
||||||
extern int wc_set_useragent(bvm *vm);
|
extern int wc_set_useragent(bvm *vm);
|
||||||
|
extern int wc_set_follow_redirects(bvm *vm);
|
||||||
extern int wc_set_auth(bvm *vm);
|
extern int wc_set_auth(bvm *vm);
|
||||||
extern int wc_connected(bvm *vm);
|
extern int wc_connected(bvm *vm);
|
||||||
extern int wc_close(bvm *vm);
|
extern int wc_close(bvm *vm);
|
||||||
|
@ -47,6 +48,7 @@ class be_class_webclient (scope: global, name: webclient) {
|
||||||
begin, func(wc_begin)
|
begin, func(wc_begin)
|
||||||
set_timeouts, func(wc_set_timeouts)
|
set_timeouts, func(wc_set_timeouts)
|
||||||
set_useragent, func(wc_set_useragent)
|
set_useragent, func(wc_set_useragent)
|
||||||
|
set_follow_redirects, func(wc_set_follow_redirects)
|
||||||
set_auth, func(wc_set_auth)
|
set_auth, func(wc_set_auth)
|
||||||
close, func(wc_close)
|
close, func(wc_close)
|
||||||
add_header, func(wc_addheader)
|
add_header, func(wc_addheader)
|
||||||
|
|
|
@ -259,6 +259,20 @@ extern "C" {
|
||||||
be_raise(vm, kTypeError, nullptr);
|
be_raise(vm, kTypeError, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wc.set_follow_redirects(bool) -> self
|
||||||
|
int32_t wc_set_follow_redirects(struct bvm *vm);
|
||||||
|
int32_t wc_set_follow_redirects(struct bvm *vm) {
|
||||||
|
int32_t argc = be_top(vm);
|
||||||
|
if (argc >= 2 && be_isbool(vm, 2)) {
|
||||||
|
HTTPClientLight * cl = wc_getclient(vm);
|
||||||
|
bbool follow = be_tobool(vm, 2);
|
||||||
|
cl->setFollowRedirects(follow ? HTTPC_STRICT_FOLLOW_REDIRECTS : HTTPC_DISABLE_FOLLOW_REDIRECTS);
|
||||||
|
be_pushvalue(vm, 1);
|
||||||
|
be_return(vm); /* return self */
|
||||||
|
}
|
||||||
|
be_raise(vm, kTypeError, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// wc.wc_set_auth(auth:string | (user:string, password:string)) -> self
|
// wc.wc_set_auth(auth:string | (user:string, password:string)) -> self
|
||||||
int32_t wc_set_auth(struct bvm *vm);
|
int32_t wc_set_auth(struct bvm *vm);
|
||||||
int32_t wc_set_auth(struct bvm *vm) {
|
int32_t wc_set_auth(struct bvm *vm) {
|
||||||
|
|
Loading…
Reference in New Issue