C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Wednesday, February 24, 2021

TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.

 Getting error when I try to execute GET Method,

TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.


SOLUTION : Example

       [HttpGet]

        [Route("Appointment")]

        [SwaggerOperation(Tags = new[] { "Hospital/Scheduling" })]

        public ActionResult<List<Appointment>> GetAppointmentsV1([FromBody] GetAppointmentsRequest request)

        {

            try

            {

                var result = appointmentApi.GetAppointments(request);

                return result.Result;

            }

            catch (Exception Ex)

            {

                throw Ex;

            }

        }


Change  [FromBody]   to [FromQuery]

No comments:

Post a Comment