我使用邮递员创建要点,并在授权选项卡中添加了承载令牌,但它想创建要点并返回201 Created,但返回200 OK,并且不创建任何内容,请在此处输入图像描述
我已经在请求正文中编写了GitHub Docs提到的创建Gist的示例
{
"description": "Hello World Examples",
"public": true,
"files": {
"hello_world.rb": {
"content": "class HelloWorld\n def initialize(name)\n @name = name.capitalize\n end\n def sayHi\n puts \"Hello !\"\n end\nend\n\nhello = HelloWorld.new(\"World\")\nhello.sayHi"
},
"hello_world.py": {
"content": "class HelloWorld:\n\n def __init__(self, name):\n self.name = name.capitalize()\n \n def sayHi(self):\n print \"Hello \" + self.name + \"!\"\n\nhello = HelloWorld(\"world\")\nhello.sayHi()"
},
"hello_world_ruby.txt": {
"content": "Run `ruby hello_world.rb` to print Hello World"
},
"hello_world_python.txt": {
"content": "Run `python hello_world.py` to print Hello World"
}
}
}
https://docs.github.com/cn/free-pro-team@latest/rest/reference/gists#create-a-gist
身份验证您可以匿名阅读公共摘要,但是必须登录GitHub才能创建摘要。要代表用户读取或写入要点,您需要要点OAuth范围和令牌。有关更多信息,请参阅“ OAuth应用程序的范围”。
您应该通过身份验证,否则您将只有读权限,这就是为什么您获得200而不是201的原因
第二个原因:您使用的是http而不是https
使用从开发人员设置生成的令牌作为oauth2承载:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句