Android之Retrofit報錯Form-encoded method must contain at least one @Field.
今天使用retrofit的時候,介面引數寫成這樣報錯:Form-encoded method must contain at least one @Field....
@FormUrlEncoded @POST("/appApi/client/familyInfo/insertFamilyInfo") Observable<BaseRespModel> insertFamilyInfo ( @QueryMap Map<String,String> paramsMap );
經過了解,原來post請求,不能用@Query 或@QueryMap 引數,必須要使用@FieldMap,改成這樣:
@FormUrlEncoded
@POST("/appApi/client/familyInfo/insertFamilyInfo")
Observable<BaseRespModel> insertFamilyInfo (
@FieldMap Map<String,String> paramsMap
);
總結:
retrofit使用get請求,少引數使用@Query 註解,多引數使用@QueryMap;
使用post請求,少引數使用@Field 註解,多引數使用@FieldMap。
相關文章
- python報錯:TypeError: slice indices must be integers or None or have an __index__ methodPythonErrorNoneIndex
- allowedOrigins cannot contain the gateway 報錯AIGateway
- gateway 報錯 allowedOrigins cannot contain the specialGatewayAI
- centos 16安裝PHP7.0 異常 No pool defined. at least one pool section must be specified in config fileCentOSPHPAST
- IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokensExceptionHTTP
- TypeError: The ‘compilation‘ argument must be an instance of Compilation 報錯Error
- Setup had an error Error: At least one of these paths should existErrorAST
- Android之viewpager. PagerAdapter destroyItem報錯AndroidViewpagerAPT
- 報錯indexerror: tensors used as indices must be long, byte or bool tensorsIndexError
- Python:Python3錯誤提示TypeError: slice indices must be integers or None or have an __index__ method解決辦法PythonErrorNoneIndex
- Android之Retrofit2.0 處理返回json報文並轉換成bean物件AndroidJSONBean物件
- 【安裝Android Studio報錯之解決方案】Android
- Android Retrofit原始碼解析Android原始碼
- [STF 求助帖] stf-app 模組報錯 Key must be a bufferAPP
- flutter和Android混編下出現“No implementation found for method xxxx on channel”錯誤FlutterAndroid
- [Android] Retrofit原始碼:流程解析Android原始碼
- thinkphp升級後報錯Declaration of thinkappUrl::build() must be compatible with think outeUrl::build():PHPAPPUI
- SQL2012報錯:cannot find one or more cpmponentsSQL
- 關於報錯Error creating bean with name 'xxxxx': Invocation of init method....ErrorBean
- Maven建立SSM專案 啟動時報錯Mapped Statements collection does not contain value for xxxMavenSSMAPPAI
- 【Redis】錯誤:failed: Hostname must not be empty or nullRedisAINull
- Input報錯“Form elements must have labels: Element has no title attribute Element has no placeholde”ORM
- android DDMS method profiling 工具使用分析Android
- Android中Retrofit的封裝使用Android封裝
- Android Retrofit原始碼解析:都能看懂的Retrofit使用詳解Android原始碼
- 引入第三方庫報錯Could not find method apt() for argumentsAPT
- jmeter分散式測試報錯Error in rconfigure() method java.lang.ClassCastExceptionJMeter分散式ErrorJavaASTException
- Android技能樹 — 網路小結(7)之 Retrofit原始碼詳細解析Android原始碼
- Android Retrofit 2.5.0使用基礎詳解Android
- Android 網路框架 Retrofit 原始碼解析Android框架原始碼
- Android XML佈局報錯:android/view/View$OnUnhandledKeyEventListenerAndroidXMLView
- Elasticsearch 6 建立索引報錯 invalid_index_name_exception Invalid index name [testDemo], must be lowercaseElasticsearch索引IndexException
- vue專案報錯[Vue warn]: Property “visible“ must be accessed with “$data.visible“ because properties startVue
- npm報錯 TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.Received undefineNPMError
- Swift 5 之後 "Method Swizzling"?Swift
- Property visible must be accessed with $ or _ are not proxied in the Vue instance to prevent錯誤Vue
- SparkStreaming報錯: Only one SparkContext may be running in this JVM (see SPARK-2243)SparkContextJVM
- SpringBoot整合Junit單元測試找不到bean報錯:expected at least 1 bean which qualifies as autowire candidateSpring BootBeanAST