<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; ">
Then my second recommendation fits the bill, yes?
<div><br>
</div>
<div>&gt;&gt;&gt; content_type = b._browser._response.info().getheaders(&quot;content-type&quot;)[0]</div>
<div>&gt;&gt;&gt; assert&nbsp;content_type == 'application/json; charset=utf-8', ('Content-type is not json!')</div>
<div><br>
</div>
<div><span class="Apple-style-span" style="color: rgb(84, 0, 0); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "></span></span>Kevin</div>
<div><br>
<div>
<div>
<div>On Jun 7, 2010, at 6:49 PM, Mike Orr wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Yes, I can print them, but what I want is for my Twill script to check<br>
the header like it does with 'find'. &nbsp;Abort if it doesn't match, and<br>
not print anything if it does match.<br>
<br>
On Mon, Jun 7, 2010 at 3:12 PM, Kevin Boers &lt;<a href="mailto:KBoers@leapfrogonline.com">KBoers@leapfrogonline.com</a>&gt; wrote:<br>
<blockquote type="cite">Hi, Mike,<br>
</blockquote>
<blockquote type="cite">It's pretty easy to print the response headers using the info() method:<br>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">import twill.commands as twill<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">twill.go('http://path/to/json_file.json')<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite"><a href="http://twill.info">twill.info</a>()<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">Page information:<br>
</blockquote>
<blockquote type="cite">URL: <a href="http://path/to/json_file.json">http://path/to/json_file.json</a><br>
</blockquote>
<blockquote type="cite">HTTP code: 200<br>
</blockquote>
<blockquote type="cite">Content type: application/json; charset=utf-8<br>
</blockquote>
<blockquote type="cite">It's not super straightforward, but you can also grab the response headers<br>
</blockquote>
<blockquote type="cite">from the browser object as well (for example, if you want to assert against<br>
</blockquote>
<blockquote type="cite">them):<br>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">b = twill.get_browser()<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">b._browser._response.info().getheaders(&quot;content-type&quot;)<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">['application/json; charset=utf-8']<br>
</blockquote>
<blockquote type="cite">Does that help?<br>
</blockquote>
<blockquote type="cite">Cheers,<br>
</blockquote>
<blockquote type="cite">Kevin<br>
</blockquote>
<blockquote type="cite">On Jun 7, 2010, at 4:46 PM, Mike Orr wrote:<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Hi there, I've been using Twill for a few months and find it a great<br>
</blockquote>
<blockquote type="cite">way to write a few basic tests to verify a site isn't broken. But I've<br>
</blockquote>
<blockquote type="cite">come across what seems to be a missing feature. How can I test an HTTP<br>
</blockquote>
<blockquote type="cite">header; e.g., to verify that a JSON response is actually<br>
</blockquote>
<blockquote type="cite">&quot;Content-type: application/json&quot;?<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">--<br>
</blockquote>
<blockquote type="cite">Mike Orr &lt;<a href="mailto:sluggoster@gmail.com">sluggoster@gmail.com</a>&gt;<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">_______________________________________________<br>
</blockquote>
<blockquote type="cite">twill mailing list<br>
</blockquote>
<blockquote type="cite"><a href="mailto:twill@lists.idyll.org">twill@lists.idyll.org</a><br>
</blockquote>
<blockquote type="cite"><a href="http://lists.idyll.org/listinfo/twill">http://lists.idyll.org/listinfo/twill</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Kevin P. Boers<br>
</blockquote>
<blockquote type="cite">QA Manager<br>
</blockquote>
<blockquote type="cite">847-440-8381<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Leapfrog Online<br>
</blockquote>
<blockquote type="cite">807 Greenwood<br>
</blockquote>
<blockquote type="cite">Evanston, IL &nbsp;60201<br>
</blockquote>
<blockquote type="cite">Main 847-492-1968<br>
</blockquote>
<blockquote type="cite">Fax &nbsp;847-492-1990<br>
</blockquote>
<blockquote type="cite"><a href="mailto:kboers@leapfrogonline.com">kboers@leapfrogonline.com</a><br>
</blockquote>
<blockquote type="cite"><a href="http://www.leapfrogonline.com">www.leapfrogonline.com</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">________________________________<br>
</blockquote>
<blockquote type="cite">CONFIDENTIALITY NOTE<br>
</blockquote>
<blockquote type="cite">The document(s) accompanying this e-mail transmission, if any, and the<br>
</blockquote>
<blockquote type="cite">e-mail transmittal message containing information from Leapfrog Online<br>
</blockquote>
<blockquote type="cite">Customer Acquisition, LLC is confidential or privileged. The information is<br>
</blockquote>
<blockquote type="cite">intended to be for the use of the individual(s) or entity(ies) named on this<br>
</blockquote>
<blockquote type="cite">e-mail transmission message. If you are not the intended recipient, be aware<br>
</blockquote>
<blockquote type="cite">that any disclosure, copying, distribution or use of the contents of this<br>
</blockquote>
<blockquote type="cite">e-mail is prohibited. If you have received this e-mail in error, please<br>
</blockquote>
<blockquote type="cite">immediately delete this e-mail and notify us by telephone of the error.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">_______________________________________________<br>
</blockquote>
<blockquote type="cite">twill mailing list<br>
</blockquote>
<blockquote type="cite"><a href="mailto:twill@lists.idyll.org">twill@lists.idyll.org</a><br>
</blockquote>
<blockquote type="cite"><a href="http://lists.idyll.org/listinfo/twill">http://lists.idyll.org/listinfo/twill</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<br>
<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><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<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>
</span></div>
<br>
</div>
</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>