<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cutter-Assertions-for-HTTP-client-and-server">
<refmeta>
<refentrytitle role="top_of_page" id="cutter-Assertions-for-HTTP-client-and-server.top_of_page">Assertions for HTTP client and server</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CUTTER Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Assertions for HTTP client and server</refname>
<refpurpose>Checks that your HTTP client/server
works as you expect with libsoup support.</refpurpose>
</refnamediv>

<refsynopsisdiv id="cutter-Assertions-for-HTTP-client-and-server.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis><link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="soupcut-client-assert-equal-body">soupcut_client_assert_equal_body</link>    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="soupcut-client-assert-equal-content-type">soupcut_client_assert_equal_content_type</link>
                                                        (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="soupcut-client-assert-match-body">soupcut_client_assert_match_body</link>    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *pattern</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="soupcut-client-assert-response">soupcut_client_assert_response</link>      (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="soupcut-message-assert-equal-content-type">soupcut_message_assert_equal_content_type</link>
                                                        (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupMessage"><type>SoupMessage</type></link> *message</parameter>,
                                                         <parameter>...</parameter>);
</synopsis>
</refsynopsisdiv>

<refsect1 id="cutter-Assertions-for-HTTP-client-and-server.description" role="desc">
<title role="desc.title">Description</title>

</refsect1>
<refsect1 id="cutter-Assertions-for-HTTP-client-and-server.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="soupcut-client-assert-equal-body" role="function" condition="since:1.0.8">
<title>soupcut_client_assert_equal_body ()</title>
<indexterm zone="soupcut-client-assert-equal-body" role="1.0.8"><primary>soupcut_client_assert_equal_body</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                soupcut_client_assert_equal_body    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Passes if <parameter>expected</parameter> == <parameter>client->response_body->data</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>expected</parameter>&#160;:</term>
<listitem><simpara>an expected response body.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>client</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>optional message. See <link linkend="cut-message"><function>cut_message()</function></link> for details.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-client-assert-equal-content-type" role="function" condition="since:1.0.8">
<title>soupcut_client_assert_equal_content_type ()</title>
<indexterm zone="soupcut-client-assert-equal-content-type" role="1.0.8"><primary>soupcut_client_assert_equal_content_type</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                soupcut_client_assert_equal_content_type
                                                        (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Passes if <parameter>expected</parameter> equals to Content-Type of the latest
message of <parameter>client</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>expected</parameter>&#160;:</term>
<listitem><simpara>an expected Content-Type.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>client</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>optional message. See <link linkend="cut-message"><function>cut_message()</function></link> for details.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-client-assert-match-body" role="function" condition="since:1.0.8">
<title>soupcut_client_assert_match_body ()</title>
<indexterm zone="soupcut-client-assert-match-body" role="1.0.8"><primary>soupcut_client_assert_match_body</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                soupcut_client_assert_match_body    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *pattern</parameter>,
                                                         <parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Passes if <parameter>pattern</parameter> matches the response body of
the latest message of <parameter>client</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>pattern</parameter>&#160;:</term>
<listitem><simpara>the regular expression pattern.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>client</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>optional message. See <link linkend="cut-message"><function>cut_message()</function></link> for details.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-client-assert-response" role="function" condition="since:1.0.8">
<title>soupcut_client_assert_response ()</title>
<indexterm zone="soupcut-client-assert-response" role="1.0.8"><primary>soupcut_client_assert_response</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                soupcut_client_assert_response      (<parameter><link linkend="SoupCutClient"><type>SoupCutClient</type></link> *client</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Passes if status code of <parameter>client</parameter> is 2XX.
</para><variablelist role="params">
<varlistentry><term><parameter>client</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupCutClient"><type>SoupCutClient</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>optional message. See <link linkend="cut-message"><function>cut_message()</function></link> for details.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-message-assert-equal-content-type" role="function" condition="since:1.0.8">
<title>soupcut_message_assert_equal_content_type ()</title>
<indexterm zone="soupcut-message-assert-equal-content-type" role="1.0.8"><primary>soupcut_message_assert_equal_content_type</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                soupcut_message_assert_equal_content_type
                                                        (<parameter>const <link linkend="gchar"><type>gchar</type></link> *expected</parameter>,
                                                         <parameter><link linkend="SoupMessage"><type>SoupMessage</type></link> *message</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Passes if <parameter>expected</parameter> == <parameter>message->response_headers->content_type</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>expected</parameter>&#160;:</term>
<listitem><simpara>an expected Content-Type.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>message</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupMessage"><type>SoupMessage</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>optional message. See <link linkend="cut-message"><function>cut_message()</function></link> for details.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>

</refsect1>

</refentry>
