Skip to content

Commit

Permalink
Add ETag/Conditional Get
Browse files Browse the repository at this point in the history
  • Loading branch information
RISCfuture committed Apr 6, 2024
1 parent c223e66 commit b232d61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/flights_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FlightsController < ApplicationController
# |:-----|:----------------------|
# | `id` | The UUID of a Flight. |

def show = respond_with @flight
def show = respond_with(@flight) if stale?(@flight)

private

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/pilot/flights_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Pilot::FlightsController < ApplicationController

def index
@flights = current_pilot.flights.with_passenger_count.order(date: :desc)
respond_with @flights
respond_with(@flights) if stale?(@flights)
end

# Creates a new Flight for a pilot from the given parameters.
Expand Down

0 comments on commit b232d61

Please sign in to comment.