Как можно исправить эту ошибку о неверном аргументе -t? - PullRequest
0 голосов
/ 24 октября 2019

2019-10-24T04: 47: 27.199Z - [ошибка] (60000) Недопустимый аргумент - t 2019-10-24T04: 47: 27.200Z :: ffff: 127.0.0.1 - POST / punch / request412 47 - 3,866 мс

Это код ошибки сервера. Я делаю проект Qrcode с использованием кода ZXING с Retrofit2. Я должен использовать этот локальный сервер swagger-edior json code. onActivitiyResult, что я должен исправить код?

export default function punchRouter(di) {
  const { models } = di
  const { Punch } = models
  const router = express.Router({})
  router.post('/request', [
    coMW(async (req, res) => {
      const sanitizer = new Sanitizer(req.query)
      const { t: type } = sanitizer
        .chain('t', t => t.shouldExists().parseInt().checkEnum(PunchType))
        .values()
      const punch = await Punch.create({ type })
      res.status(200).send(punch._id)
    }, { swallow: true }),
  ])

interface API {
    @Headers(
        "Content-Type: application/json", "Authorization: token: String"
        )
    @POST("user/login/email")
    fun login(@Body data: Data): Call<LoginResponse>

    @GET("user/confirm")
    fun confirm(@Header("authorization") token: String): Call<LoginResponse>

    @POST("punch/request")
    fun request(@Query ("Sanitizer") t: IntentResult): Call<PunchResponse>

}

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

class User {
    @SerializedName("uniqueID")
    @Expose
    val  uniqueId: String?=null

    @SerializedName("nickname")
    @Expose
    val nickname: String?=null

    @SerializedName("birth")
    @Expose
    val birth: String?=null

    @SerializedName("profileImage")
    @Expose
    val profileImage: String?=null

    @SerializedName("profileThumbnail")
    @Expose
    val profileThumbnails: String?=null

    @SerializedName("gender")
    @Expose
    val gender: Int?=null
}

class LoginResponse {
    @SerializedName("user")
    val user: User? = null

    @SerializedName("token")
    val token: String? = null
}

class PunchResponse {
    @SerializedName("Sanitizer")
    val Sanitizer: String? =null

}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) 

{
        val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
        if (result == null) {
                Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show()
            }else{
                Toast.makeText(this, "Scanned: " + result.contents, Toast.LENGTH_LONG).show()
                Client.retrofitService.request(result).enqueue(object : Callback<PunchResponse> {
                    override fun onResponse(
                        call: Call<PunchResponse>?,
                        response: Response<PunchResponse>?
                    ) {
                        Log.d(toString(), "status: ${response?.code()}. body: ${response?.body()}")

                    }

                    override fun onFailure(call: Call<PunchResponse>?, t: Throwable?) {
                    }

                })
            }

        }
    }
...