Does modify_conn only work when there is a result?

I’m trying to create a JSON API with Ash which adds headers to the response.

 post MyApp.Accounts.User, :get_by_email_and_password do
   route "/login"
   modify_conn fn conn, _subject, result, request ->
      IO.inspect(request)
      # code to add headers
    end
  end
end

I noticed that IO.inspect does not get called when there is no result from using action get_by_email_and_password. I’m wondering if the modify_conn is passed through only when there is result.

Thanks in advance :slight_smile:

Looking at the code, I see this is the case. I’m not sure if there is a specific reason for this. I think it should be possible also to do it on errors.

If this is something you need, can you please open an issue on GH for Zach to look at when he gets back from vacation.