<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi, Mike,
<div><br>
</div>
<div>It's pretty easy to print the response headers using the info() method:</div>
<div><br>
</div>
<div>&gt;&gt;&gt; import twill.commands as twill</div>
<div>&gt;&gt;&gt; twill.go('<a href="http://path/to/json_file.json'">http://path/to/json_file.json'</a>)</div>
<div>
<div>&gt;&gt;&gt; <a href="http://twill.info">twill.info</a>()</div>
<div><br>
</div>
<div>Page information:</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>URL: <a href="http://path/to/json_file.json">
http://path/to/json_file.json</a></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>HTTP code: 200</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Content type: application/json; charset=utf-8</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div>It's not super straightforward, but you can also grab the response headers from the browser object as well (for example, if you want to assert against them):</div>
<div><br>
</div>
<div>&gt;&gt;&gt; b = twill.get_browser()</div>
<div>&gt;&gt;&gt; b._browser._response.info().getheaders(&quot;content-type&quot;)</div>
<div>['application/json; charset=utf-8']</div>
<div><br>
</div>
<div>Does that help?</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Kevin</div>
<div><br>
</div>
<div>
<div>On Jun 7, 2010, at 4:46 PM, Mike Orr wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Hi there, I've been using Twill for a few months and find it a great<br>
way to write a few basic tests to verify a site isn't broken. But I've<br>
come across what seems to be a missing feature. How can I test an HTTP<br>
header; e.g., to verify that a JSON response is actually<br>
&quot;Content-type: application/json&quot;?<br>
<br>
-- <br>
Mike Orr &lt;<a href="mailto:sluggoster@gmail.com">sluggoster@gmail.com</a>&gt;<br>
<br>
_______________________________________________<br>
twill mailing list<br>
<a href="mailto:twill@lists.idyll.org">twill@lists.idyll.org</a><br>
http://lists.idyll.org/listinfo/twill<br>
</div>
</blockquote>
</div>
<br>
<div>
<div><font face="Calibri, Verdana, Helvetica, Arial"><font size="2"><span style="font-size: 10pt; "><b>Kevin P. Boers &nbsp;<br>
</b>QA Manager<br>
847-440-8381<br>
</span></font></font><font face="Times New Roman"><span style="font-size: 12pt; "><br>
</span></font><font size="2"><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 10pt; "><b>Leapfrog Online<br>
</b>807 Greenwood<br>
Evanston, IL &nbsp;60201<br>
Main 847-492-1968<br>
Fax &nbsp;847-492-1990<br>
<a href="x-msg://107/kboers@leapfrogonline.com">kboers@leapfrogonline.com</a><br>
<a href="http://www.leapfrogonline.com/">www.leapfrogonline.com</a></span></font></font></div>
</div>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">CONFIDENTIALITY NOTE<br>
The document(s) accompanying this e-mail transmission, if any, and the e-mail transmittal message containing information from Leapfrog Online Customer Acquisition, LLC is confidential or privileged. The information is intended to be for the use of the individual(s)
 or entity(ies) named on this e-mail transmission message. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this e-mail is prohibited. If you have received this e-mail in error, please immediately
 delete this e-mail and notify us by telephone of the error.<br>
</font>
</body>
</html>