C#C
C#3y ago
Natty

❔ [FromBody] and async issues...

I have this code:
 public DataFactoryController(AppIdealContext db)
        {
            _db = db;
            _client = CreateClientAsync().GetAwaiter().GetResult();
        }

        [HttpPost("TriggerPipelineOne")]
        public async Task<IActionResult> TriggerPipelineOneAsync([FromBody] PipelineOneUserSettingsRequest request)
        {
            var userSettings = ConvertUserSettingsObjectToDictionary(request);
            string pipelineOne = Environment.GetEnvironmentVariable(PIPELINEONENAME);
            return await TriggerPipelineAsync(pipelineOne, PipelineStatusOptions.StartedPipelineOne, userSettings);
        }

When I remove all the async stuff and make it
void
etc. then my FromBody works when deployed app in Azure environment. However, with the current code, I keep getting different JSON error messages in the console (even when using the same exact data each time). It seems like it's not getting the full data or something, like it's cut off at different parts, hence the different json error messages. Any ideas?
Was this page helpful?