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。
相關文章
- java.util.zip.ZipException:ZIP file must have at least one entryJavaExceptionAST
- python報錯:TypeError: slice indices must be integers or None or have an __index__ methodPythonErrorNoneIndex
- 工程中報錯或者警告(持續更新)(例如:does not contain bitcode. You must rebuild it with bitcode enabled )AIRebuild
- allowedOrigins cannot contain the gateway 報錯AIGateway
- mongodb報錯:the limit must be specified as a number。MongoDBMIT
- centos 16安裝PHP7.0 異常 No pool defined. at least one pool section must be specified in config fileCentOSPHPAST
- Checking monitor:must be configured to display at least 256 colorsAST
- gateway 報錯 allowedOrigins cannot contain the specialGatewayAI
- Access denied; you need (at least one of) the PROCESS privilege(s)AST
- IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokensExceptionHTTP
- Setup had an error Error: At least one of these paths should existErrorAST
- 使用RxJava2 + Retrofit 報錯DuplicateFileExceptionRxJavaException
- TypeError: The ‘compilation‘ argument must be an instance of Compilation 報錯Error
- Android開發之Retrofit小試牛刀Android
- [STF 求助帖] stf-app 模組報錯 Key must be a bufferAPP
- informix停資料庫是報錯:Must be a DBSA to run this programORM資料庫
- Android之viewpager. PagerAdapter destroyItem報錯AndroidViewpagerAPT
- 00017: Data frame has at least one annotation group that is enabled and contains graphicsASTAI
- android Retrofit 2.0Android
- 呼叫 webapi的put和delete 報"Method Not Allowed" 405 錯誤。WebAPIdelete
- 快速Android開發系列網路篇之RetrofitAndroid
- 報錯indexerror: tensors used as indices must be long, byte or bool tensorsIndexError
- android: ADB錯誤“more than one device and emulator”Androiddev
- Android之Retrofit2.0 處理返回json報文並轉換成bean物件AndroidJSONBean物件
- Python:Python3錯誤提示TypeError: slice indices must be integers or None or have an __index__ method解決辦法PythonErrorNoneIndex
- Android Retrofit的使用Android
- Objective-C Primer(3)Multiple arguments for one method, synthesize and dynamicObject
- 【安裝Android Studio報錯之解決方案】Android
- 引入第三方庫報錯Could not find method apt() for argumentsAPT
- Android Retrofit原始碼解析Android原始碼
- 【Redis】錯誤:failed: Hostname must not be empty or nullRedisAINull
- SQL2012報錯:cannot find one or more cpmponentsSQL
- Mac 下的MySQL ERROR 1227(42000): Access denied; you need (at least one of)MacMySqlErrorAST
- thinkphp升級後報錯Declaration of thinkappUrl::build() must be compatible with think outeUrl::build():PHPAPPUI
- Android小白之retrofit實現號碼歸屬地查詢Android
- Expert one on one oracle之後臺程式Oracle
- [Android] Retrofit原始碼:流程解析Android原始碼
- jmeter分散式測試報錯Error in rconfigure() method java.lang.ClassCastExceptionJMeter分散式ErrorJavaASTException