小编Ale*_*pov的帖子

Laravel 应用上的 Locust 登录测试

尝试使用 Locust 登录 Laravel 应用程序。我的代码如下:

from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
  def on_start(self):
    self.login()

  def login(self):
    response = self.client.get("/en/login")
    csrftoken = response.cookies['XSRF-TOKEN']
    session = response.cookies['bitrent_session']
    post_data = {'username': "user@user.com", 'password': '1234', "_token":     csrftoken }
    with self.client.post('/en/login', post_data,
                    catch_response=True) as response:
      print("Code: ", response.status_code)
      print("Content: ", response.content

  @task()
  def index(self):
    self.client.get("/")

class WebsiteUser(HttpLocust):
  task_set = UserBehavior
  min_wait = 5000
  max_wait = 9000
Run Code Online (Sandbox Code Playgroud)

但是我收到错误 - 代码 419 内容 由于不活动,页面已过期。谁能告诉我如何使用 Locust 登录 Laravel 应用程序

php python laravel locust

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

找不到“bcrypt”指令

我正在关注有关如何将 GraphQl 设置到我的项目中的 Lighthouse 官方文档。不幸的是,我遇到了以下错误:

No directive found for `bcrypt`

到目前为止我创建的架构如下:


type Query {
    users: [User!]! @paginate(defaultCount: 10)
    user(id: ID @eq): User @find
}

type User {
    id: ID!
    name: String!
    email: String!
    created_at: DateTime!
    updated_at: DateTime!
}

type Mutation {
    createUser(
        name: String!,
        email: String! @rules(apply: ["email", "unique:users"])
        password: String! @bcrypt
    ): User @create
}
Run Code Online (Sandbox Code Playgroud)

我尝试执行的查询如下:

mutation {
  createUser(
    name:"John Doe"
    email:"john@test.com"
    password: "somesupersecret"
  ) {
    id
    email
  }
}
Run Code Online (Sandbox Code Playgroud)

laravel graphql laravel-lighthouse

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

标签 统计

laravel ×2

graphql ×1

laravel-lighthouse ×1

locust ×1

php ×1

python ×1