Skip to content

Commit

Permalink
Add Copy as cURL button
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Jul 14, 2014
1 parent 0016b32 commit 95797d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sentry/interfaces/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def to_html(self, event, is_public=False, **kwargs):
'query_string': self.query_string,
'fragment': self.fragment,
'headers': self.headers,
'curl': self.to_curl(),
}
if not is_public:
# It's kind of silly we store this twice
Expand All @@ -183,7 +184,7 @@ def to_html(self, event, is_public=False, **kwargs):

def to_curl(self):
method = self.method.upper()
if self.cookies is not None:
if self.cookies:
cookies = SmartCookie(self.cookies)
# The Cookie header is already yanked out of the headers dict
# inside `to_python` so we can just safely re-set it.
Expand Down
4 changes: 4 additions & 0 deletions src/sentry/templates/sentry/partial/interfaces/http.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<div class="module">
<div class="page-header">
<a href="javascript:void(0)" data-container="#copy_as_curl" data-title="Copy as cURL" class="popup btn small pull-right" style="margin-left: 5px">{% trans "Copy as cURL" %}</a>
{% if not is_public %}
<a href="{% url 'sentry-replay' event.team.slug event.project.slug event.group_id event.id %}" class="btn small pull-right">{% trans "Replay this request" %}</a>
{% endif %}
Expand Down Expand Up @@ -76,3 +77,6 @@ <h2>{% trans "Request" %}</h2>
</table>
</div>
</div>
<div id="copy_as_curl" style="display: none;">
<pre>{{ curl }}</pre>
</div>

0 comments on commit 95797d7

Please sign in to comment.