2

Using .net core c#

I have a simple api controller as:

 public class ValuesController : ControllerBase
 {
        // GET api/values
        [HttpGet]

        public ActionResult<IEnumerable<string>> Get()
        {
            return new string[] { "value1", "value2" };            
        }
  }

There is not much into my startup file of the app.

I am using AWS to deploy this. The issue is when this deployed an is behind API gateway this runs and returns content type as:

Content-Type →application/json; charset=utf-8

But when this is behind our lambda and ELB then this returns us as:

Content-Type →application/octet-stream

We are not sure whats is the solution here. There is nothing in my code that would make it return like above.

I even tried decorating my controller as:

 [Produces("application/json")]

But still does not work. Not sure if we have to make any code changes or any configuration changes that we are not aware of.

Anyone has any inputs?

user1563677
  • 713
  • 3
  • 15
  • 38
  • 1
    Im not sure, but seems like lambda is configured to set specific response header to octet-stream. Try to look at AWS configuration. Maybe this post can help: https://stackoverflow.com/questions/43190935/setting-http-response-header-from-aws-lambda – eocron May 07 '19 at 19:19
  • @eocron Do you know how can I specifically add headers to my lambda – user1563677 May 09 '19 at 12:26
  • Sorry, but I can't help you. Im not that familliar with this technology. – eocron May 13 '19 at 13:59

0 Answers0