小编Jai*_*eas的帖子

在Swagger中更改为Url-Form-Encoded Post请求

我想知道是否可以在Swagger中创建一个url-form编码的帖子请求?例如:

POST https://url.co.uk
Host: server.example.com
Authorization: Bearer <Initial Access Token>
Content-Type: application/x-www-form-urlencoded

&grant_type=password
&client_id=<client id>
&client_secret=<client secret>
Run Code Online (Sandbox Code Playgroud)

目前我们有各种参数的布局,但不知道如何更改为url-form-encoded.我们尝试过更换为in:body标题而不是标题,但这不起作用.请参阅grant-type参数的示例

          "parameters": [
                {
                    "in": "header",
                    "name": "grant_type",
                    "description": "Indicates that the app is using the Resource Owner Password \"password\".",
                    "required": true,
                    "type": "string",
                    "enum": [
                        "password"
                        ] 
                },
Run Code Online (Sandbox Code Playgroud)

目前返回的是:

Accept: application/json
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,fa;q=0.6,sv;q=0.4
Cache-Control: no-cache
Connection: keep-alive
Origin: http://editor.swagger.io
Referer: http://editor.swagger.io/
User-Agent: Mozilla/5.0 
grant_type: password
client_id: xxx-xxx-xxx
client_secret: <client_secret>
Run Code Online (Sandbox Code Playgroud)

对此有任何帮助/见解将不胜感激 - 甚至让我知道它是否可能?

post swagger

2
推荐指数
2
解决办法
6967
查看次数

数组中没有重复的颜色

学习 JavaScript 并需要一些建议。我有一段简单的代码,可以在单击元素时更改元素的颜色,但我不希望在 onclick 事件上从数组中重复颜色。我将如何做到这一点或帮助学习什么是最被接受的做到这一点的方式。

尝试使用 IF 语句。

var colors = ["red", "blue", "green", "orange", "purple", "pink"];

document.querySelector('.circle').onclick = function changeColor() {
    var rand = colors[Math.floor(Math.random() * colors.length)];
    document.querySelector('.circle').style.color = rand; 

     console.log(rand);

    }
Run Code Online (Sandbox Code Playgroud)

我希望颜色会改变但不会重复。

javascript

0
推荐指数
1
解决办法
852
查看次数

标签 统计

javascript ×1

post ×1

swagger ×1