why getting volley.clienterror

Viewed 29

I have been trying to create a simple login register I'm first trying to create a register seems all the codes are code but still getting volley.client error response on mobile, Getting Volley.ClientError

E/Volley: [753] NetworkUtility.shouldRetryException: Unexpected response code 400 for http://10.0.2.2/LoginRegister/api/user/register

Mobile Part Reg

        @Overrid
        protected Map<String, String> getParams() throws AuthFailureError {

            Map<String, String> params = new HashMap<String, String>();
            new JSONObject(params);
            params.put("usern" , uname);
            params.put("pass", pass);
            params.put("cpass",r_pass);
            params.put("e-mail", email);
            return super.getParams();
        }
    };

    RequestQueue requestQueue = Volley.newRequestQueue(this);
    try {
       URLEncoder.encode(stringRequest.toString(),"UTF-8");
    } catch (Exception e) {
        e.printStackTrace();
    }
    requestQueue.add(stringRequest);

Web API

class User extends CI_Controller {

    public function index()
    {
        json_output(200, ['index' => 1]);
    }

    public function register()
    {

$this->output->set_output(json_encode(["success"]));
        $this->form_validation->set_rules('usern', 'Username', 'required|callback_userCheck');
        $this->form_validation->set_rules('pass', 'Password', 'required|min_length[8]|max_length[20]');
        $this->form_validation->set_rules('cpass', 'Confirmation Password', 'required|matches[pass]|min_length[8]');
        $this->form_validation->set_rules('e-mail', 'Email', 'required|valid_email|callback_emailCheck');
        if ($this->form_validation->run() == FALSE)
        {
            json_output(422, ['errors' => $this->form_validation->error_array()]);
        }
        else
        {
            $this->Welcome_model->add_user();
            json_output(200, ['message' => 'registered_successfully']);
        }
    }

i already tried this solutions but still no luck any reason Basic authentication in android using Volley for GIthub. Getting error code 422 BasicNetwork.performRequest: Unexpected response code 422 for Volley

0 Answers
Related