gpt4 book ai didi

r - httr 禁用 "Expect: 100-continue"

转载 作者:行者123 更新时间:2023-12-03 21:54:38 29 4
gpt4 key购买 nike

我正在尝试将 json 发送到 bosun在 R 中使用 httr::POST

set_config(verbose()) 已启用,我看到标题:Expect: 100-continue 这可能会触发 jetty 错误。

命令是:

response <- httr::POST(url = "http://192.168.65.1:8070/api/put?details", 
body = json_str,
add_headers("Content-Type" = "application/json; charset=UTF-8"))

详细显示:

-> POST http://192.168.65.1:8070/api/put?details HTTP/1.1
-> User-Agent: curl/7.35.0 Rcurl/1.96.0 httr/0.6.0
-> Host: 192.168.65.1:8070
-> Accept: */*
-> Accept-Encoding: gzip
-> Proxy-Connection: Keep-Alive
-> Content-Type: application/json; charset=UTF-8
-> Content-Length: 1
-> Expect: 100-continue

我应该如何禁用 header Expect: 100-continue

这是我的sessionInfo():

R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C
[5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] RJSONIO_1.3-0 httr_0.6.0 RCurl_1.96-0

loaded via a namespace (and not attached):
[1] bitops_1.0-6 stringr_0.6.2 tools_3.1.2

最佳答案

要禁用 Expect header ,只需将其设置为空字符串即可。添加

add_headers("Expect"="")

到您的 POST 电话

关于r - httr 禁用 "Expect: 100-continue",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27645298/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com