Tag: gmail api

restAssured – 不能掌握post方法

同胞stackoverflowians 🙂 我一直在用戒烟的时间来使用Gmail API进行邮寄。 一直试图使用createDraft和createLabel。 现在我想我已经找到了正确的(主要)如何做到这一点,但我得到这个错误: java.lang.AssertionError: 1 expectation failed. Expected status code <200> but was <400>. 我意识到发生这个错误,因为我做出不正确的请求。 你能帮我一下吗? 这是我的代码: import io.restassured.RestAssured.* import io.restassured.http.ContentType import io.restassured.matcher.RestAssuredMatchers.* import org.hamcrest.Matchers.* import org.testng.annotations.Test class RestAPIAutoTestPost { @Test fun createLabelInGoogleMail() { RestAssured.baseURI = "https://www.googleapis.com/gmail/v1/users/me" val accessToken = "ya29.Glw7BEv6***" val jsonAsMap = HashMap<String, Any>() jsonAsMap.put("id", "labelAPITestNameID") jsonAsMap.put("labelListVisibility", "labelShow") jsonAsMap.put("messageListVisibility", "show") […]