Class: Wurk::ProfilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wurk/profiles_controller.rb

Overview

Profiles pane non-JSON endpoints (spec §25.4):

GET /profiles/:key/data  → the stored gzipped gecko JSON, streamed with a
                           gzip Content-Encoding (Firefox profiler pulls
                           this when given a `from-url` source).
GET /profiles/:key       → upload the profile to the Firefox profiler
                           store and 302 to its public view URL.

‘:key` is “<token>-<jid>”. The JSON list lives at /api/profiles.

Instance Method Summary collapse

Instance Method Details

#dataObject



20
21
22
23
24
25
26
# File 'app/controllers/wurk/profiles_controller.rb', line 20

def data
  blob = profile_blob(params[:key])
  return head(:not_found) unless blob

  response.headers['Content-Encoding'] = 'gzip'
  send_data blob, type: 'application/json', disposition: 'inline'
end

#showObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/wurk/profiles_controller.rb', line 28

def show
  blob = profile_blob(params[:key])
  return head(:not_found) unless blob

  hash = upload_to_profiler(blob)
  return head(:bad_gateway) unless hash

  redirect_to(format(::Wurk::Web.config.profile_view_url, hash), allow_other_host: true)
end