title: retrofit.HttpException: HTTP 400 Bad Request android (closed)
body: <p>I am trying to implement a <strong>basic user registration</strong>.
  I am using RxJava and retrofit (v2 beta).</p>
  
  <pre class="lang-none prettyprint-override"><code>URL: http://momento-w03d.c9users.io/register
  Fields
  username
  password
  fullname
  email
  </code></pre>
  
  <p>When I use postman to send these 4 fields as form-data
  response is : <code>["success"]</code></p>
  
  <p>Is there something I am doing wrong or it is because I am using cloud9 server.</p>
  
  <p>I am new to retrofit, and I am not able to understand where am I making the mistake.
  Thanks a lot for your time.</p>
  
  <blockquote>
    <p>Class <code>AuthServiceFactory</code></p>
  </blockquote>
  
  <pre class="lang-java prettyprint-override"><code>public class AuthServiceFactory {
      private static Retrofit.Builder builder = new Retrofit.Builder()
                      .baseUrl(AuthService.BASE_URL)
                      .addConverterFactory(GsonConverterFactory.create())
                      .addCallAdapterFactory(RxJavaCallAdapterFactory.create());
  
  
      public static &lt;S&gt; S createService(Class&lt;S&gt; clazz) {
          final Retrofit retrofit = builder.build();
          S service = retrofit.create(clazz);
          return service;
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Interface <code>AuthService</code></p>
  </blockquote>
  
  <pre class="lang-java prettyprint-override"><code>public interface AuthService {
      String BASE_URL = "http://momento-w03d.c9users.io";
  
      @FormUrlEncoded
      @POST("/register")
      Observable&lt;Message&gt; register(@Field("username") String username,
                                   @Field("password") String password,
                                   @Field("email") String email,
                                   @Field("fullname") String fullname);
  }
  </code></pre>
  
  <blockquote>
    <p>Model class <code>Message</code></p>
  </blockquote>
  
  <pre class="lang-java prettyprint-override"><code>public class Message {
      private String message;
  
      public String getMessage() {
          return message;
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Method body that sends request</p>
  </blockquote>
  
  <pre><code>AuthService authService = AuthServiceFactory.createService(AuthService.class);
  authService.register("lorem", "12345678", "lorem@gmail.com", "lorem imposium")
                          .subscribeOn(Schedulers.newThread())
                          .observeOn(AndroidSchedulers.mainThread())
                          .subscribe(new Subscriber&lt;Message&gt;() {
      @Override
      public void onCompleted() {
  
      }
  
      @Override
      public void onError(Throwable e) {
          e.printStackTrace();
      }
  
      @Override
      public void onNext(Message message) {
          System.out.println(message.getMessage());
      }
  });
  </code></pre>
  
  <blockquote>
    <p>StackTrace</p>
  </blockquote>
  
  <pre><code>W/System.err: retrofit.HttpException: HTTP 400 Bad Request
  W/System.err:     at retrofit.RxJavaCallAdapterFactory$SimpleCallAdapter$1.call(RxJavaCallAdapterFactory.java:163)
  W/System.err:     at retrofit.RxJavaCallAdapterFactory$SimpleCallAdapter$1.call(RxJavaCallAdapterFactory.java:158)
  W/System.err:     at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55)
  W/System.err:     at retrofit.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:113)
  W/System.err:     at retrofit.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:88)
  W/System.err:     at rx.Observable$2.call(Observable.java:162)
  W/System.err:     at rx.Observable$2.call(Observable.java:154)
  W/System.err:     at rx.Observable$2.call(Observable.java:162)
  W/System.err:     at rx.Observable$2.call(Observable.java:154)
  W/System.err:     at rx.Observable.unsafeSubscribe(Observable.java:7710)
  W/System.err:     at rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)
  W/System.err:     at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
  W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
  W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
  W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
  W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  W/System.err:     at java.lang.Thread.run(Thread.java:818)
  </code></pre>