안녕하세요. http 통신을 하려 하는데 포스트로 했을때 파라미터가 안넘어가네요.
private void AsyncLogin(RequestParams params) {
AsynHttpClient.post(LOGIN_URL, params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Log.v("TAG", "response : " + response);
try {
String msg = (String) response.get("msg");
int code = response.getInt("code");
Log.v("test", "msg,code : " + msg + "code" + code);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
try {
Log.e("onFailure: ", "onFailure ---------------------------------------------------------------");
Log.e("statusCode : ", String.valueOf(statusCode));
Log.e("headers : ", String.valueOf(headers));
Log.e("responseString : ", responseString);
}catch (Exception e) {
e.printStackTrace();
}
}
});
}
다음과 같이 호출을 했는데 파라미터가 안넘겨지다보니 에러가 나네요.
서버는 스프링 자바로 되어있는데, 이게 스프링 기본인지
Postman으로 테스트 시에 "x-www-form-urlencoded"로 선택해서 보낼때만 넘어가지는데
그래서 호출할 때 entity 만들어서 "Content-type" "application/x-www-form-urlencoded"로 추가해서 해보기도 하고
AsyncHttpClient.addHeader("Content-type", "application/x-www-form-urlencoded");도 해보고 했는데
다 안되네요;;
혹시 이런 경험 해보신 분 계신가요?