问题标签 [hug]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 如何将 JSON 字符串分配给 POST 请求中的变量,以便在函数中使用?
我正在 python 中使用 hug 编写一个 API,我无法将 JSON 字符串传递给我的函数使用的变量,然后它将被添加到数据库中。我正在使用 RestClient Firefox 插件来发送 POST 请求。
这是我的功能的样子:
我的内容类型是:'Content-Type: application/json'
. 这是我在 RestClient 主体中的样子:
截至目前使用此代码,我收到此错误:json.decoder.JSONDecodeError: Invalid control character at: line 1 column 16 (char 15)
谢谢。
python - Hug API:在 @hug.object.urls 中使用前缀时,GET 端点不起作用
我在 Python 3.8.0 中使用了 hug 2.6.1,当我在 hug.object.urls 中使用前缀时,我遇到了 GET 端点问题。例如,此代码不起作用(/test/myendpoint 返回 404 http 状态错误):
我在做坏事?或者这是一个问题?