如何解决你如何在 Polka.js 框架中设置响应状态码
看起来应该很简单。
尝试:
Find
抓住我:
TypeError: res.status 不是函数
这是在工兵中,不确定这是否有所不同。
解决方法
根据 the docs,您使用 self
,或者如果您在中间件中抛出错误,您将使用 import random,copy
class cards:
chest_cards = (["Go to..."])
chance_cards = (["Go to Ja..."])
def __init__(self):
#before you over-write self.chest_cards,it refers to the class attribute
self.chest_cards = copy.copy(self.chest_cards) #make a local copy so you don't alter the master list
#after you over-write it,it will refer to the instance attribute as long as you made a copy.
#you can also refer to the class directly to access class-attributes
self.chest_cards = copy.copy(cards.chest_cards)
#if you want to get the class without calling it by name (in case you want to change the name of the class)
self.chest_cards = copy.copy(type(self).chest_cards)
random.shuffle(self.chest_cards)
。
具体做法如下:
res.writeHead(500,{'Content-Type': 'text/plain'})
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。