title: Getting 415 Error on updating using PUT method
body: <p>I am using JWT spring security in backend and I would like to update user details in angular using PUT method. But I am getting 415 error on update.</p>
  <p>Update method in springboot
  controller</p>
  <pre><code>@PutMapping(&quot;/UpdateUser/{id}&quot;)
  public ResponseEntity&lt;User&gt; updateUsers(@PathVariable(&quot;id&quot;) Long id,@RequestBody User user){
      User update = userService.updateUser(user);
      return new ResponseEntity&lt;&gt;(update, HttpStatus.OK);
  }
  </code></pre>
  <p>Angular service</p>
  <pre><code>    import { HttpClient, HttpHeaders } from '@angular/common/http';
      import { Injectable } from '@angular/core';
      import { UserAuthService } from './user-auth.service';
      
      @Injectable({
        providedIn: 'root',
      })
      export class UserService {
        PATH_OF_API = 'http://localhost:9090';
      
        requestHeader = new HttpHeaders({ 'No-Auth': 'True' });
        constructor(
          private httpclient: HttpClient,
          private userAuthService: UserAuthService
        ) {}
      
        public sign(signData){
          return this.httpclient.post(this.PATH_OF_API + '/registerNewUser',signData,{
            headers:this.requestHeader
          });
        }
      
      
        updateUser(userId:number,user){
          return this.httpclient.put(this.PATH_OF_API + '/UpdateUser/'+userId,userId,user);
        }
  }
  
  Error
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Ib63z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ib63z.png" alt="Error image" /></a></p>
  <pre><code>Request URL: http://localhost:9090/UpdateUser/1663565697945
  Request Method: PUT
  Status Code: 415 
  Remote Address: [::1]:9090
  Referrer Policy: strict-origin-when-cross-origin
  
  **Response header**
  Accept: application/json, application/*+json
  Access-Control-Allow-Credentials: true
  Access-Control-Allow-Origin: http://localhost:4200
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Connection: keep-alive
  Content-Type: application/json
  Date: Mon, 19 Sep 2022 16:35:21 GMT
  Expires: 0
  Keep-Alive: timeout=60
  Pragma: no-cache
  Transfer-Encoding: chunked
  Vary: Origin
  Vary: Access-Control-Request-Method
  Vary: Access-Control-Request-Headers
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block
  **Request header**
  Accept: application/json, text/plain, */*
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.9
  Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJrZWVydGhpMTIzIiwiZXhwIjoxNjYzNjE4MTc0LCJpYXQiOjE2NjM2MDAxNzR9.2YxIgdM78TZDNpwFIkB_-KfZ4DwlWKlN7Xzf4V4D2g4kCQr7kJdpx0ExbN9CTWAxtokzjlk_K22ROQEzBgGKnw
  Connection: keep-alive
  Content-Length: 13
  Content-Type: text/plain
  Host: localhost:9090
  Origin: http://localhost:4200
  Referer: http://localhost:4200/
  Sec-Fetch-Dest: empty
  Sec-Fetch-Mode: cors
  </code></pre>
  <p>{
  &quot;timestamp&quot;:&quot;2022-09-19T16:35:21.514+00:00&quot;,
  &quot;status&quot;:415,
  &quot;error&quot;:&quot;Unsupported Media Type&quot;,
  &quot;message&quot;:&quot;&quot;,
  &quot;path&quot;:&quot;/UpdateUser/1663565697945&quot;
  }</p>
  <p>How can I solve this error. Help me to solve this issue.</p>