title: Fetch method Formpara Javascript
body: <p>this is my jersey server, REST api using java</p>
  
  <pre><code>    @POST
          @Produces({MediaType.APPLICATION_JSON})
          @Path("registration")
          public User register(@FormParam("username") String userName, @FormParam("password") String password) {
  
              boolean isOk = true;
              User newUser =null;
              List&lt;User&gt; userList = em.createNamedQuery("User.findAll").getResultList();
              for(User user: userList){
                      if(user.getUsername().equals(userName)){
                      isOk = false;
                  }
              }
              if(isOk == true){
                  newUser = new User();
                  newUser.setUsername(userName);
                  newUser.setPassword(password);
                  super.create(newUser);
              }
  
              return newUser;
          }
  </code></pre>
  
  <p>I use javascript to POST new user to the server via formdata</p>
  
  <pre><code>  buttonLogin.addEventListener('click', (evt) =&gt; {
    evt.preventDefault();
    console.log('login');
  
    const  imgData = new FormData();
    imgData.append('username', 'newuser');
    imgData.append('password', '123');
  
    for (var p of imgData) {
    console.log(p);
  }
    //
    let url = endPointUrl + `webresources/users/registration`;
    const myHeader = new Headers({'Content-Type':"application/x-www-form-urlencoded"});
  
    fetch(url, {
      method: 'POST',
      headers: myHeader,
      data: imgData
    })
    .then(json)
    .then((data) =&gt; {
      console.log(data);
        });
  });
  </code></pre>
  
  <p>My server did receive formparam but it is null object. I expect that the server will receive username: "newuser" and password "123" but server receive null object
  I test server with postman and everything is ok. So I assume that the problem is javascript code. 
  Could you show me what is wrong with my code. Thank</p>