1668 1697 | #[allow(unreachable_code, unused_variables)]
|
1669 1698 | #[cfg(test)]
|
1670 1699 | mod json_unions_test {
|
1671 1700 |
|
1672 1701 | /// Serializes a string union value
|
1673 1702 | /// Test ID: AwsJson10SerializeStringUnionValue
|
1674 1703 | #[::tokio::test]
|
1675 1704 | #[::tracing_test::traced_test]
|
1676 1705 | async fn aws_json10_serialize_string_union_value_request() {
|
1677 1706 | #[allow(unused_mut)]
|
1678 - | let mut http_request = http::Request::builder()
|
1707 + | let mut http_request = ::http_1x::Request::builder()
|
1679 1708 | .uri("/")
|
1680 1709 | .method("POST")
|
1681 1710 | .header("Content-Type", "application/x-amz-json-1.0")
|
1682 1711 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1683 - | .body(::aws_smithy_http_server::body::Body::from(
|
1684 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1685 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
1712 + | .body(::aws_smithy_http_server::body::boxed(
|
1713 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1714 + | &::aws_smithy_protocol_test::decode_body_data(
|
1715 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}"
|
1716 + | .as_bytes(),
|
1686 1717 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1718 + | ),
|
1687 1719 | )),
|
1688 1720 | ))
|
1689 1721 | .unwrap();
|
1690 1722 | #[allow(unused_mut)]
|
1691 1723 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1692 1724 | let config = crate::service::JsonRpc10Config::builder().build();
|
1693 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
1725 + | let service =
|
1726 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1727 + | config,
|
1728 + | )
|
1694 1729 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1695 1730 | let sender = sender.clone();
|
1696 1731 | async move {
|
1697 1732 | let result = {
|
1698 1733 | let expected = crate::input::JsonUnionsInput {
|
1699 1734 | contents: ::std::option::Option::Some(
|
1700 1735 | crate::model::MyUnion::StringValue("foo".to_owned()),
|
1701 1736 | ),
|
1702 1737 | };
|
1703 1738 | ::pretty_assertions::assert_eq!(input, expected);
|
1704 1739 | let output = crate::output::JsonUnionsOutput {
|
1705 1740 | contents: ::std::option::Option::None,
|
1706 1741 | };
|
1707 1742 | Ok(output)
|
1708 1743 | };
|
1709 1744 | sender.send(()).await.expect("receiver dropped early");
|
1710 1745 | result
|
1711 1746 | }
|
1712 1747 | })
|
1713 1748 | .build_unchecked();
|
1714 1749 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1715 1750 | .await
|
1716 1751 | .expect("unable to make an HTTP request");
|
1717 1752 | assert!(
|
1718 1753 | receiver.recv().await.is_some(),
|
1719 1754 | "we expected operation handler to be invoked but it was not entered"
|
1720 1755 | );
|
1721 1756 | }
|
1722 1757 |
|
1723 1758 | /// Serializes a boolean union value
|
1724 1759 | /// Test ID: AwsJson10SerializeBooleanUnionValue
|
1725 1760 | #[::tokio::test]
|
1726 1761 | #[::tracing_test::traced_test]
|
1727 1762 | async fn aws_json10_serialize_boolean_union_value_request() {
|
1728 1763 | #[allow(unused_mut)]
|
1729 - | let mut http_request = http::Request::builder()
|
1764 + | let mut http_request = ::http_1x::Request::builder()
|
1730 1765 | .uri("/")
|
1731 1766 | .method("POST")
|
1732 1767 | .header("Content-Type", "application/x-amz-json-1.0")
|
1733 1768 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1734 - | .body(::aws_smithy_http_server::body::Body::from(
|
1735 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1736 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
1769 + | .body(::aws_smithy_http_server::body::boxed(
|
1770 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1771 + | &::aws_smithy_protocol_test::decode_body_data(
|
1772 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}"
|
1773 + | .as_bytes(),
|
1737 1774 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1775 + | ),
|
1738 1776 | )),
|
1739 1777 | ))
|
1740 1778 | .unwrap();
|
1741 1779 | #[allow(unused_mut)]
|
1742 1780 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1743 1781 | let config = crate::service::JsonRpc10Config::builder().build();
|
1744 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
1782 + | let service =
|
1783 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1784 + | config,
|
1785 + | )
|
1745 1786 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1746 1787 | let sender = sender.clone();
|
1747 1788 | async move {
|
1748 1789 | let result = {
|
1749 1790 | let expected = crate::input::JsonUnionsInput {
|
1750 1791 | contents: ::std::option::Option::Some(
|
1751 1792 | crate::model::MyUnion::BooleanValue(true),
|
1752 1793 | ),
|
1753 1794 | };
|
1754 1795 | ::pretty_assertions::assert_eq!(input, expected);
|
1755 1796 | let output = crate::output::JsonUnionsOutput {
|
1756 1797 | contents: ::std::option::Option::None,
|
1757 1798 | };
|
1758 1799 | Ok(output)
|
1759 1800 | };
|
1760 1801 | sender.send(()).await.expect("receiver dropped early");
|
1761 1802 | result
|
1762 1803 | }
|
1763 1804 | })
|
1764 1805 | .build_unchecked();
|
1765 1806 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1766 1807 | .await
|
1767 1808 | .expect("unable to make an HTTP request");
|
1768 1809 | assert!(
|
1769 1810 | receiver.recv().await.is_some(),
|
1770 1811 | "we expected operation handler to be invoked but it was not entered"
|
1771 1812 | );
|
1772 1813 | }
|
1773 1814 |
|
1774 1815 | /// Serializes a number union value
|
1775 1816 | /// Test ID: AwsJson10SerializeNumberUnionValue
|
1776 1817 | #[::tokio::test]
|
1777 1818 | #[::tracing_test::traced_test]
|
1778 1819 | async fn aws_json10_serialize_number_union_value_request() {
|
1779 1820 | #[allow(unused_mut)]
|
1780 - | let mut http_request = http::Request::builder()
|
1821 + | let mut http_request = ::http_1x::Request::builder()
|
1781 1822 | .uri("/")
|
1782 1823 | .method("POST")
|
1783 1824 | .header("Content-Type", "application/x-amz-json-1.0")
|
1784 1825 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1785 - | .body(::aws_smithy_http_server::body::Body::from(
|
1786 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1826 + | .body(::aws_smithy_http_server::body::boxed(
|
1827 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1828 + | &::aws_smithy_protocol_test::decode_body_data(
|
1787 1829 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
1788 1830 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1831 + | ),
|
1789 1832 | )),
|
1790 1833 | ))
|
1791 1834 | .unwrap();
|
1792 1835 | #[allow(unused_mut)]
|
1793 1836 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1794 1837 | let config = crate::service::JsonRpc10Config::builder().build();
|
1795 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
1838 + | let service =
|
1839 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1840 + | config,
|
1841 + | )
|
1796 1842 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1797 1843 | let sender = sender.clone();
|
1798 1844 | async move {
|
1799 1845 | let result = {
|
1800 1846 | let expected = crate::input::JsonUnionsInput {
|
1801 1847 | contents: ::std::option::Option::Some(
|
1802 1848 | crate::model::MyUnion::NumberValue(1),
|
1803 1849 | ),
|
1804 1850 | };
|
1805 1851 | ::pretty_assertions::assert_eq!(input, expected);
|
1806 1852 | let output = crate::output::JsonUnionsOutput {
|
1807 1853 | contents: ::std::option::Option::None,
|
1808 1854 | };
|
1809 1855 | Ok(output)
|
1810 1856 | };
|
1811 1857 | sender.send(()).await.expect("receiver dropped early");
|
1812 1858 | result
|
1813 1859 | }
|
1814 1860 | })
|
1815 1861 | .build_unchecked();
|
1816 1862 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1817 1863 | .await
|
1818 1864 | .expect("unable to make an HTTP request");
|
1819 1865 | assert!(
|
1820 1866 | receiver.recv().await.is_some(),
|
1821 1867 | "we expected operation handler to be invoked but it was not entered"
|
1822 1868 | );
|
1823 1869 | }
|
1824 1870 |
|
1825 1871 | /// Serializes a blob union value
|
1826 1872 | /// Test ID: AwsJson10SerializeBlobUnionValue
|
1827 1873 | #[::tokio::test]
|
1828 1874 | #[::tracing_test::traced_test]
|
1829 1875 | async fn aws_json10_serialize_blob_union_value_request() {
|
1830 1876 | #[allow(unused_mut)]
|
1831 - | let mut http_request = http::Request::builder()
|
1877 + | let mut http_request = ::http_1x::Request::builder()
|
1832 1878 | .uri("/")
|
1833 1879 | .method("POST")
|
1834 1880 | .header("Content-Type", "application/x-amz-json-1.0")
|
1835 1881 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1836 - | .body(::aws_smithy_http_server::body::Body::from(
|
1837 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1838 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
1882 + | .body(::aws_smithy_http_server::body::boxed(
|
1883 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1884 + | &::aws_smithy_protocol_test::decode_body_data(
|
1885 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}"
|
1886 + | .as_bytes(),
|
1839 1887 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1888 + | ),
|
1840 1889 | )),
|
1841 1890 | ))
|
1842 1891 | .unwrap();
|
1843 1892 | #[allow(unused_mut)]
|
1844 1893 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1845 1894 | let config = crate::service::JsonRpc10Config::builder().build();
|
1846 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
1895 + | let service = crate::service::JsonRpc10::builder::<
|
1896 + | ::aws_smithy_http_server::body::BoxBody,
|
1897 + | _,
|
1898 + | _,
|
1899 + | _,
|
1900 + | >(config)
|
1847 1901 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1848 1902 | let sender = sender.clone();
|
1849 1903 | async move {
|
1850 1904 | let result = {
|
1851 1905 | let expected = crate::input::JsonUnionsInput {
|
1852 - | contents: ::std::option::Option::Some(
|
1853 - | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
1854 - | "foo",
|
1906 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1907 + | ::aws_smithy_types::Blob::new("foo"),
|
1855 1908 | )),
|
1856 - | ),
|
1857 1909 | };
|
1858 1910 | ::pretty_assertions::assert_eq!(input, expected);
|
1859 1911 | let output = crate::output::JsonUnionsOutput {
|
1860 1912 | contents: ::std::option::Option::None,
|
1861 1913 | };
|
1862 1914 | Ok(output)
|
1863 1915 | };
|
1864 1916 | sender.send(()).await.expect("receiver dropped early");
|
1865 1917 | result
|
1866 1918 | }
|
1867 1919 | })
|
1868 1920 | .build_unchecked();
|
1869 1921 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1870 1922 | .await
|
1871 1923 | .expect("unable to make an HTTP request");
|
1872 1924 | assert!(
|
1873 1925 | receiver.recv().await.is_some(),
|
1874 1926 | "we expected operation handler to be invoked but it was not entered"
|
1875 1927 | );
|
1876 1928 | }
|
1877 1929 |
|
1878 1930 | /// Serializes a timestamp union value
|
1879 1931 | /// Test ID: AwsJson10SerializeTimestampUnionValue
|
1880 1932 | #[::tokio::test]
|
1881 1933 | #[::tracing_test::traced_test]
|
1882 1934 | async fn aws_json10_serialize_timestamp_union_value_request() {
|
1883 1935 | #[allow(unused_mut)]
|
1884 - | let mut http_request = http::Request::builder()
|
1936 + | let mut http_request = ::http_1x::Request::builder()
|
1885 1937 | .uri("/")
|
1886 1938 | .method("POST")
|
1887 1939 | .header("Content-Type", "application/x-amz-json-1.0")
|
1888 1940 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1889 - | .body(::aws_smithy_http_server::body::Body::from(
|
1890 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1941 + | .body(::aws_smithy_http_server::body::boxed(
|
1942 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1943 + | &::aws_smithy_protocol_test::decode_body_data(
|
1891 1944 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
1892 1945 | .as_bytes(),
|
1893 1946 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1947 + | ),
|
1894 1948 | )),
|
1895 1949 | ))
|
1896 1950 | .unwrap();
|
1897 1951 | #[allow(unused_mut)]
|
1898 1952 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1899 1953 | let config = crate::service::JsonRpc10Config::builder().build();
|
1900 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
1954 + | let service =
|
1955 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1956 + | config,
|
1957 + | )
|
1901 1958 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1902 1959 | let sender = sender.clone();
|
1903 1960 | async move {
|
1904 1961 | let result = {
|
1905 1962 | let expected = crate::input::JsonUnionsInput {
|
1906 1963 | contents: ::std::option::Option::Some(
|
1907 1964 | crate::model::MyUnion::TimestampValue(
|
1908 1965 | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1909 1966 | 1398796238, 0_f64,
|
1910 1967 | ),
|
1911 1968 | ),
|
1912 1969 | ),
|
1913 1970 | };
|
1914 1971 | ::pretty_assertions::assert_eq!(input, expected);
|
1915 1972 | let output = crate::output::JsonUnionsOutput {
|
1916 1973 | contents: ::std::option::Option::None,
|
1917 1974 | };
|
1918 1975 | Ok(output)
|
1919 1976 | };
|
1920 1977 | sender.send(()).await.expect("receiver dropped early");
|
1921 1978 | result
|
1922 1979 | }
|
1923 1980 | })
|
1924 1981 | .build_unchecked();
|
1925 1982 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1926 1983 | .await
|
1927 1984 | .expect("unable to make an HTTP request");
|
1928 1985 | assert!(
|
1929 1986 | receiver.recv().await.is_some(),
|
1930 1987 | "we expected operation handler to be invoked but it was not entered"
|
1931 1988 | );
|
1932 1989 | }
|
1933 1990 |
|
1934 1991 | /// Serializes an enum union value
|
1935 1992 | /// Test ID: AwsJson10SerializeEnumUnionValue
|
1936 1993 | #[::tokio::test]
|
1937 1994 | #[::tracing_test::traced_test]
|
1938 1995 | async fn aws_json10_serialize_enum_union_value_request() {
|
1939 1996 | #[allow(unused_mut)]
|
1940 - | let mut http_request = http::Request::builder()
|
1997 + | let mut http_request = ::http_1x::Request::builder()
|
1941 1998 | .uri("/")
|
1942 1999 | .method("POST")
|
1943 2000 | .header("Content-Type", "application/x-amz-json-1.0")
|
1944 2001 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
1945 - | .body(::aws_smithy_http_server::body::Body::from(
|
1946 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1947 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
2002 + | .body(::aws_smithy_http_server::body::boxed(
|
2003 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2004 + | &::aws_smithy_protocol_test::decode_body_data(
|
2005 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}"
|
2006 + | .as_bytes(),
|
1948 2007 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2008 + | ),
|
1949 2009 | )),
|
1950 2010 | ))
|
1951 2011 | .unwrap();
|
1952 2012 | #[allow(unused_mut)]
|
1953 2013 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1954 2014 | let config = crate::service::JsonRpc10Config::builder().build();
|
1955 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2015 + | let service = crate::service::JsonRpc10::builder::<
|
2016 + | ::aws_smithy_http_server::body::BoxBody,
|
2017 + | _,
|
2018 + | _,
|
2019 + | _,
|
2020 + | >(config)
|
1956 2021 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1957 2022 | let sender = sender.clone();
|
1958 2023 | async move {
|
1959 2024 | let result = {
|
1960 2025 | let expected = crate::input::JsonUnionsInput {
|
1961 - | contents: ::std::option::Option::Some(
|
1962 - | crate::model::MyUnion::EnumValue(
|
2026 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1963 2027 | "Foo"
|
1964 2028 | .parse::<crate::model::FooEnum>()
|
1965 2029 | .expect("static value validated to member"),
|
1966 - | ),
|
1967 - | ),
|
2030 + | )),
|
1968 2031 | };
|
1969 2032 | ::pretty_assertions::assert_eq!(input, expected);
|
1970 2033 | let output = crate::output::JsonUnionsOutput {
|
1971 2034 | contents: ::std::option::Option::None,
|
1972 2035 | };
|
1973 2036 | Ok(output)
|
1974 2037 | };
|
1975 2038 | sender.send(()).await.expect("receiver dropped early");
|
1976 2039 | result
|
1977 2040 | }
|
1978 2041 | })
|
1979 2042 | .build_unchecked();
|
1980 2043 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1981 2044 | .await
|
1982 2045 | .expect("unable to make an HTTP request");
|
1983 2046 | assert!(
|
1984 2047 | receiver.recv().await.is_some(),
|
1985 2048 | "we expected operation handler to be invoked but it was not entered"
|
1986 2049 | );
|
1987 2050 | }
|
1988 2051 |
|
1989 2052 | /// Serializes an intEnum union value
|
1990 2053 | /// Test ID: AwsJson10SerializeIntEnumUnionValue
|
1991 2054 | #[::tokio::test]
|
1992 2055 | #[::tracing_test::traced_test]
|
1993 2056 | async fn aws_json10_serialize_int_enum_union_value_request() {
|
1994 2057 | #[allow(unused_mut)]
|
1995 - | let mut http_request = http::Request::builder()
|
2058 + | let mut http_request = ::http_1x::Request::builder()
|
1996 2059 | .uri("/")
|
1997 2060 | .method("POST")
|
1998 2061 | .header("Content-Type", "application/x-amz-json-1.0")
|
1999 2062 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
2000 - | .body(::aws_smithy_http_server::body::Body::from(
|
2001 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2063 + | .body(::aws_smithy_http_server::body::boxed(
|
2064 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2065 + | &::aws_smithy_protocol_test::decode_body_data(
|
2002 2066 | "{\n \"contents\": {\n \"intEnumValue\": 1\n }\n}".as_bytes(),
|
2003 2067 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2068 + | ),
|
2004 2069 | )),
|
2005 2070 | ))
|
2006 2071 | .unwrap();
|
2007 2072 | #[allow(unused_mut)]
|
2008 2073 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2009 2074 | let config = crate::service::JsonRpc10Config::builder().build();
|
2010 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2075 + | let service =
|
2076 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
2077 + | config,
|
2078 + | )
|
2011 2079 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
2012 2080 | let sender = sender.clone();
|
2013 2081 | async move {
|
2014 2082 | let result = {
|
2015 2083 | let expected = crate::input::JsonUnionsInput {
|
2016 2084 | contents: ::std::option::Option::Some(
|
2017 2085 | crate::model::MyUnion::IntEnumValue(1),
|
2018 2086 | ),
|
2019 2087 | };
|
2020 2088 | ::pretty_assertions::assert_eq!(input, expected);
|
2021 2089 | let output = crate::output::JsonUnionsOutput {
|
2022 2090 | contents: ::std::option::Option::None,
|
2023 2091 | };
|
2024 2092 | Ok(output)
|
2025 2093 | };
|
2026 2094 | sender.send(()).await.expect("receiver dropped early");
|
2027 2095 | result
|
2028 2096 | }
|
2029 2097 | })
|
2030 2098 | .build_unchecked();
|
2031 2099 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2032 2100 | .await
|
2033 2101 | .expect("unable to make an HTTP request");
|
2034 2102 | assert!(
|
2035 2103 | receiver.recv().await.is_some(),
|
2036 2104 | "we expected operation handler to be invoked but it was not entered"
|
2037 2105 | );
|
2038 2106 | }
|
2039 2107 |
|
2040 2108 | /// Serializes a list union value
|
2041 2109 | /// Test ID: AwsJson10SerializeListUnionValue
|
2042 2110 | #[::tokio::test]
|
2043 2111 | #[::tracing_test::traced_test]
|
2044 2112 | async fn aws_json10_serialize_list_union_value_request() {
|
2045 2113 | #[allow(unused_mut)]
|
2046 - | let mut http_request = http::Request::builder()
|
2114 + | let mut http_request = ::http_1x::Request::builder()
|
2047 2115 | .uri("/")
|
2048 2116 | .method("POST")
|
2049 2117 | .header("Content-Type", "application/x-amz-json-1.0")
|
2050 2118 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
2051 - | .body(::aws_smithy_http_server::body::Body::from(
|
2052 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2053 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
2054 - | .as_bytes(),
|
2055 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2056 - | )),
|
2057 - | ))
|
2058 - | .unwrap();
|
2119 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2120 + | ::bytes::Bytes::copy_from_slice(
|
2121 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2122 + | )
|
2123 + | ))).unwrap();
|
2059 2124 | #[allow(unused_mut)]
|
2060 2125 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2061 2126 | let config = crate::service::JsonRpc10Config::builder().build();
|
2062 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2127 + | let service = crate::service::JsonRpc10::builder::<
|
2128 + | ::aws_smithy_http_server::body::BoxBody,
|
2129 + | _,
|
2130 + | _,
|
2131 + | _,
|
2132 + | >(config)
|
2063 2133 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
2064 2134 | let sender = sender.clone();
|
2065 2135 | async move {
|
2066 2136 | let result = {
|
2067 2137 | let expected = crate::input::JsonUnionsInput {
|
2068 - | contents: ::std::option::Option::Some(
|
2069 - | crate::model::MyUnion::ListValue(vec![
|
2070 - | "foo".to_owned(),
|
2071 - | "bar".to_owned(),
|
2072 - | ]),
|
2073 - | ),
|
2138 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(
|
2139 + | vec!["foo".to_owned(), "bar".to_owned()],
|
2140 + | )),
|
2074 2141 | };
|
2075 2142 | ::pretty_assertions::assert_eq!(input, expected);
|
2076 2143 | let output = crate::output::JsonUnionsOutput {
|
2077 2144 | contents: ::std::option::Option::None,
|
2078 2145 | };
|
2079 2146 | Ok(output)
|
2080 2147 | };
|
2081 2148 | sender.send(()).await.expect("receiver dropped early");
|
2082 2149 | result
|
2083 2150 | }
|
2084 2151 | })
|
2085 2152 | .build_unchecked();
|
2086 2153 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2087 2154 | .await
|
2088 2155 | .expect("unable to make an HTTP request");
|
2089 2156 | assert!(
|
2090 2157 | receiver.recv().await.is_some(),
|
2091 2158 | "we expected operation handler to be invoked but it was not entered"
|
2092 2159 | );
|
2093 2160 | }
|
2094 2161 |
|
2095 2162 | /// Serializes a map union value
|
2096 2163 | /// Test ID: AwsJson10SerializeMapUnionValue
|
2097 2164 | #[::tokio::test]
|
2098 2165 | #[::tracing_test::traced_test]
|
2099 2166 | async fn aws_json10_serialize_map_union_value_request() {
|
2100 2167 | #[allow(unused_mut)]
|
2101 - | let mut http_request = http::Request::builder()
|
2168 + | let mut http_request = ::http_1x::Request::builder()
|
2102 2169 | .uri("/")
|
2103 2170 | .method("POST")
|
2104 2171 | .header("Content-Type", "application/x-amz-json-1.0")
|
2105 2172 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
2106 - | .body(::aws_smithy_http_server::body::Body::from(
|
2173 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2107 2174 | ::bytes::Bytes::copy_from_slice(
|
2108 2175 | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2109 2176 | )
|
2110 - | )).unwrap();
|
2177 + | ))).unwrap();
|
2111 2178 | #[allow(unused_mut)]
|
2112 2179 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2113 2180 | let config = crate::service::JsonRpc10Config::builder().build();
|
2114 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2181 + | let service = crate::service::JsonRpc10::builder::<
|
2182 + | ::aws_smithy_http_server::body::BoxBody,
|
2183 + | _,
|
2184 + | _,
|
2185 + | _,
|
2186 + | >(config)
|
2115 2187 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
2116 2188 | let sender = sender.clone();
|
2117 2189 | async move {
|
2118 2190 | let result = {
|
2119 2191 | let expected = crate::input::JsonUnionsInput {
|
2120 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
2121 - | {
|
2192 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
2122 2193 | let mut ret = ::std::collections::HashMap::new();
|
2123 2194 | ret.insert("foo".to_owned(), "bar".to_owned());
|
2124 2195 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
2125 2196 | ret
|
2126 - | },
|
2127 - | )),
|
2197 + | })),
|
2128 2198 | };
|
2129 2199 | ::pretty_assertions::assert_eq!(input, expected);
|
2130 2200 | let output = crate::output::JsonUnionsOutput {
|
2131 2201 | contents: ::std::option::Option::None,
|
2132 2202 | };
|
2133 2203 | Ok(output)
|
2134 2204 | };
|
2135 2205 | sender.send(()).await.expect("receiver dropped early");
|
2136 2206 | result
|
2137 2207 | }
|
2138 2208 | })
|
2139 2209 | .build_unchecked();
|
2140 2210 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2141 2211 | .await
|
2142 2212 | .expect("unable to make an HTTP request");
|
2143 2213 | assert!(
|
2144 2214 | receiver.recv().await.is_some(),
|
2145 2215 | "we expected operation handler to be invoked but it was not entered"
|
2146 2216 | );
|
2147 2217 | }
|
2148 2218 |
|
2149 2219 | /// Serializes a structure union value
|
2150 2220 | /// Test ID: AwsJson10SerializeStructureUnionValue
|
2151 2221 | #[::tokio::test]
|
2152 2222 | #[::tracing_test::traced_test]
|
2153 2223 | async fn aws_json10_serialize_structure_union_value_request() {
|
2154 2224 | #[allow(unused_mut)]
|
2155 - | let mut http_request = http::Request::builder()
|
2225 + | let mut http_request = ::http_1x::Request::builder()
|
2156 2226 | .uri("/")
|
2157 2227 | .method("POST")
|
2158 2228 | .header("Content-Type", "application/x-amz-json-1.0")
|
2159 2229 | .header("X-Amz-Target", "JsonRpc10.JsonUnions")
|
2160 - | .body(::aws_smithy_http_server::body::Body::from(
|
2230 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2161 2231 | ::bytes::Bytes::copy_from_slice(
|
2162 2232 | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2163 2233 | )
|
2164 - | )).unwrap();
|
2234 + | ))).unwrap();
|
2165 2235 | #[allow(unused_mut)]
|
2166 2236 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2167 2237 | let config = crate::service::JsonRpc10Config::builder().build();
|
2168 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2238 + | let service = crate::service::JsonRpc10::builder::<
|
2239 + | ::aws_smithy_http_server::body::BoxBody,
|
2240 + | _,
|
2241 + | _,
|
2242 + | _,
|
2243 + | >(config)
|
2169 2244 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
2170 2245 | let sender = sender.clone();
|
2171 2246 | async move {
|
2172 2247 | let result = {
|
2173 2248 | let expected = crate::input::JsonUnionsInput {
|
2174 2249 | contents: ::std::option::Option::Some(
|
2175 - | crate::model::MyUnion::StructureValue(
|
2176 - | crate::model::GreetingStruct {
|
2250 + | crate::model::MyUnion::StructureValue(crate::model::GreetingStruct {
|
2177 2251 | hi: ::std::option::Option::Some("hello".to_owned()),
|
2178 - | },
|
2179 - | ),
|
2252 + | }),
|
2180 2253 | ),
|
2181 2254 | };
|
2182 2255 | ::pretty_assertions::assert_eq!(input, expected);
|
2183 2256 | let output = crate::output::JsonUnionsOutput {
|
2184 2257 | contents: ::std::option::Option::None,
|
2185 2258 | };
|
2186 2259 | Ok(output)
|
2187 2260 | };
|
2188 2261 | sender.send(()).await.expect("receiver dropped early");
|
2189 2262 | result
|
2190 2263 | }
|
2191 2264 | })
|
2192 2265 | .build_unchecked();
|
2193 2266 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2194 2267 | .await
|
2195 2268 | .expect("unable to make an HTTP request");
|
2196 2269 | assert!(
|
2197 2270 | receiver.recv().await.is_some(),
|
2198 2271 | "we expected operation handler to be invoked but it was not entered"
|
2199 2272 | );
|
2200 2273 | }
|
2201 2274 |
|
2202 2275 | /// Deserializes a string union value
|
2203 2276 | /// Test ID: AwsJson10DeserializeStringUnionValue
|
2204 2277 | #[::tokio::test]
|
2205 2278 | #[::tracing_test::traced_test]
|
2206 2279 | async fn aws_json10_deserialize_string_union_value_response() {
|
2207 2280 | let output = crate::output::JsonUnionsOutput {
|
2208 2281 | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
2209 2282 | "foo".to_owned(),
|
2210 2283 | )),
|
2211 2284 | };
|
2212 2285 | use ::aws_smithy_http_server::response::IntoResponse;
|
2213 2286 | let http_response = output.into_response();
|
2214 2287 | ::pretty_assertions::assert_eq!(
|
2215 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2288 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2216 2289 | http_response.status()
|
2217 2290 | );
|
2218 2291 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2219 2292 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2220 2293 | http_response.headers(),
|
2221 2294 | expected_headers,
|
2222 2295 | ));
|
2223 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2296 + | use ::http_body_util::BodyExt;
|
2297 + | let body = http_response
|
2298 + | .into_body()
|
2299 + | .collect()
|
2224 2300 | .await
|
2225 - | .expect("unable to extract body to bytes");
|
2301 + | .expect("unable to collect body")
|
2302 + | .to_bytes();
|
2226 2303 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2227 2304 | &body,
|
2228 2305 | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
2229 2306 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2230 2307 | ));
|
2231 2308 | }
|
2232 2309 |
|
2233 2310 | /// Deserializes a boolean union value
|
2234 2311 | /// Test ID: AwsJson10DeserializeBooleanUnionValue
|
2235 2312 | #[::tokio::test]
|
2236 2313 | #[::tracing_test::traced_test]
|
2237 2314 | async fn aws_json10_deserialize_boolean_union_value_response() {
|
2238 2315 | let output = crate::output::JsonUnionsOutput {
|
2239 2316 | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
2240 2317 | };
|
2241 2318 | use ::aws_smithy_http_server::response::IntoResponse;
|
2242 2319 | let http_response = output.into_response();
|
2243 2320 | ::pretty_assertions::assert_eq!(
|
2244 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2321 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2245 2322 | http_response.status()
|
2246 2323 | );
|
2247 2324 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2248 2325 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2249 2326 | http_response.headers(),
|
2250 2327 | expected_headers,
|
2251 2328 | ));
|
2252 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2329 + | use ::http_body_util::BodyExt;
|
2330 + | let body = http_response
|
2331 + | .into_body()
|
2332 + | .collect()
|
2253 2333 | .await
|
2254 - | .expect("unable to extract body to bytes");
|
2334 + | .expect("unable to collect body")
|
2335 + | .to_bytes();
|
2255 2336 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2256 2337 | &body,
|
2257 2338 | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
2258 2339 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2259 2340 | ));
|
2260 2341 | }
|
2261 2342 |
|
2262 2343 | /// Deserializes a number union value
|
2263 2344 | /// Test ID: AwsJson10DeserializeNumberUnionValue
|
2264 2345 | #[::tokio::test]
|
2265 2346 | #[::tracing_test::traced_test]
|
2266 2347 | async fn aws_json10_deserialize_number_union_value_response() {
|
2267 2348 | let output = crate::output::JsonUnionsOutput {
|
2268 2349 | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
2269 2350 | };
|
2270 2351 | use ::aws_smithy_http_server::response::IntoResponse;
|
2271 2352 | let http_response = output.into_response();
|
2272 2353 | ::pretty_assertions::assert_eq!(
|
2273 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2354 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2274 2355 | http_response.status()
|
2275 2356 | );
|
2276 2357 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2277 2358 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2278 2359 | http_response.headers(),
|
2279 2360 | expected_headers,
|
2280 2361 | ));
|
2281 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2362 + | use ::http_body_util::BodyExt;
|
2363 + | let body = http_response
|
2364 + | .into_body()
|
2365 + | .collect()
|
2282 2366 | .await
|
2283 - | .expect("unable to extract body to bytes");
|
2367 + | .expect("unable to collect body")
|
2368 + | .to_bytes();
|
2284 2369 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2285 2370 | &body,
|
2286 2371 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
2287 2372 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2288 2373 | ));
|
2289 2374 | }
|
2290 2375 |
|
2291 2376 | /// Deserializes a blob union value
|
2292 2377 | /// Test ID: AwsJson10DeserializeBlobUnionValue
|
2293 2378 | #[::tokio::test]
|
2294 2379 | #[::tracing_test::traced_test]
|
2295 2380 | async fn aws_json10_deserialize_blob_union_value_response() {
|
2296 2381 | let output = crate::output::JsonUnionsOutput {
|
2297 2382 | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
2298 2383 | ::aws_smithy_types::Blob::new("foo"),
|
2299 2384 | )),
|
2300 2385 | };
|
2301 2386 | use ::aws_smithy_http_server::response::IntoResponse;
|
2302 2387 | let http_response = output.into_response();
|
2303 2388 | ::pretty_assertions::assert_eq!(
|
2304 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2389 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2305 2390 | http_response.status()
|
2306 2391 | );
|
2307 2392 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2308 2393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2309 2394 | http_response.headers(),
|
2310 2395 | expected_headers,
|
2311 2396 | ));
|
2312 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2397 + | use ::http_body_util::BodyExt;
|
2398 + | let body = http_response
|
2399 + | .into_body()
|
2400 + | .collect()
|
2313 2401 | .await
|
2314 - | .expect("unable to extract body to bytes");
|
2402 + | .expect("unable to collect body")
|
2403 + | .to_bytes();
|
2315 2404 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2316 2405 | &body,
|
2317 2406 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
2318 2407 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2319 2408 | ));
|
2320 2409 | }
|
2321 2410 |
|
2322 2411 | /// Deserializes a timestamp union value
|
2323 2412 | /// Test ID: AwsJson10DeserializeTimestampUnionValue
|
2324 2413 | #[::tokio::test]
|
2325 2414 | #[::tracing_test::traced_test]
|
2326 2415 | async fn aws_json10_deserialize_timestamp_union_value_response() {
|
2327 2416 | let output = crate::output::JsonUnionsOutput {
|
2328 2417 | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
2329 2418 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
2330 2419 | )),
|
2331 2420 | };
|
2332 2421 | use ::aws_smithy_http_server::response::IntoResponse;
|
2333 2422 | let http_response = output.into_response();
|
2334 2423 | ::pretty_assertions::assert_eq!(
|
2335 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2424 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2336 2425 | http_response.status()
|
2337 2426 | );
|
2338 2427 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2339 2428 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2340 2429 | http_response.headers(),
|
2341 2430 | expected_headers,
|
2342 2431 | ));
|
2343 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2432 + | use ::http_body_util::BodyExt;
|
2433 + | let body = http_response
|
2434 + | .into_body()
|
2435 + | .collect()
|
2344 2436 | .await
|
2345 - | .expect("unable to extract body to bytes");
|
2437 + | .expect("unable to collect body")
|
2438 + | .to_bytes();
|
2346 2439 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2347 2440 | &body,
|
2348 2441 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
2349 2442 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2350 2443 | ));
|
2351 2444 | }
|
2352 2445 |
|
2353 2446 | /// Deserializes an enum union value
|
2354 2447 | /// Test ID: AwsJson10DeserializeEnumUnionValue
|
2355 2448 | #[::tokio::test]
|
2356 2449 | #[::tracing_test::traced_test]
|
2357 2450 | async fn aws_json10_deserialize_enum_union_value_response() {
|
2358 2451 | let output = crate::output::JsonUnionsOutput {
|
2359 2452 | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
2360 2453 | "Foo"
|
2361 2454 | .parse::<crate::model::FooEnum>()
|
2362 2455 | .expect("static value validated to member"),
|
2363 2456 | )),
|
2364 2457 | };
|
2365 2458 | use ::aws_smithy_http_server::response::IntoResponse;
|
2366 2459 | let http_response = output.into_response();
|
2367 2460 | ::pretty_assertions::assert_eq!(
|
2368 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2461 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2369 2462 | http_response.status()
|
2370 2463 | );
|
2371 2464 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2372 2465 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2373 2466 | http_response.headers(),
|
2374 2467 | expected_headers,
|
2375 2468 | ));
|
2376 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2469 + | use ::http_body_util::BodyExt;
|
2470 + | let body = http_response
|
2471 + | .into_body()
|
2472 + | .collect()
|
2377 2473 | .await
|
2378 - | .expect("unable to extract body to bytes");
|
2474 + | .expect("unable to collect body")
|
2475 + | .to_bytes();
|
2379 2476 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2380 2477 | &body,
|
2381 2478 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
2382 2479 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2383 2480 | ));
|
2384 2481 | }
|
2385 2482 |
|
2386 2483 | /// Deserializes an intEnum union value
|
2387 2484 | /// Test ID: AwsJson10DeserializeIntEnumUnionValue
|
2388 2485 | #[::tokio::test]
|
2389 2486 | #[::tracing_test::traced_test]
|
2390 2487 | async fn aws_json10_deserialize_int_enum_union_value_response() {
|
2391 2488 | let output = crate::output::JsonUnionsOutput {
|
2392 2489 | contents: ::std::option::Option::Some(crate::model::MyUnion::IntEnumValue(1)),
|
2393 2490 | };
|
2394 2491 | use ::aws_smithy_http_server::response::IntoResponse;
|
2395 2492 | let http_response = output.into_response();
|
2396 2493 | ::pretty_assertions::assert_eq!(
|
2397 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2494 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2398 2495 | http_response.status()
|
2399 2496 | );
|
2400 2497 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2401 2498 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2402 2499 | http_response.headers(),
|
2403 2500 | expected_headers,
|
2404 2501 | ));
|
2405 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2502 + | use ::http_body_util::BodyExt;
|
2503 + | let body = http_response
|
2504 + | .into_body()
|
2505 + | .collect()
|
2406 2506 | .await
|
2407 - | .expect("unable to extract body to bytes");
|
2507 + | .expect("unable to collect body")
|
2508 + | .to_bytes();
|
2408 2509 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2409 2510 | &body,
|
2410 2511 | "{\n \"contents\": {\n \"intEnumValue\": 1\n }\n}",
|
2411 2512 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2412 2513 | ));
|
2413 2514 | }
|
2414 2515 |
|
2415 2516 | /// Deserializes a list union value
|
2416 2517 | /// Test ID: AwsJson10DeserializeListUnionValue
|
2417 2518 | #[::tokio::test]
|
2418 2519 | #[::tracing_test::traced_test]
|
2419 2520 | async fn aws_json10_deserialize_list_union_value_response() {
|
2420 2521 | let output = crate::output::JsonUnionsOutput {
|
2421 2522 | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
2422 2523 | "foo".to_owned(),
|
2423 2524 | "bar".to_owned(),
|
2424 2525 | ])),
|
2425 2526 | };
|
2426 2527 | use ::aws_smithy_http_server::response::IntoResponse;
|
2427 2528 | let http_response = output.into_response();
|
2428 2529 | ::pretty_assertions::assert_eq!(
|
2429 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2530 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2430 2531 | http_response.status()
|
2431 2532 | );
|
2432 2533 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2433 2534 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2434 2535 | http_response.headers(),
|
2435 2536 | expected_headers,
|
2436 2537 | ));
|
2437 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2538 + | use ::http_body_util::BodyExt;
|
2539 + | let body = http_response
|
2540 + | .into_body()
|
2541 + | .collect()
|
2438 2542 | .await
|
2439 - | .expect("unable to extract body to bytes");
|
2543 + | .expect("unable to collect body")
|
2544 + | .to_bytes();
|
2440 2545 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2441 2546 | &body,
|
2442 2547 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
2443 2548 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2444 2549 | ));
|
2445 2550 | }
|
2446 2551 |
|
2447 2552 | /// Deserializes a map union value
|
2448 2553 | /// Test ID: AwsJson10DeserializeMapUnionValue
|
2449 2554 | #[::tokio::test]
|
2450 2555 | #[::tracing_test::traced_test]
|
2451 2556 | async fn aws_json10_deserialize_map_union_value_response() {
|
2452 2557 | let output = crate::output::JsonUnionsOutput {
|
2453 2558 | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
2454 2559 | let mut ret = ::std::collections::HashMap::new();
|
2455 2560 | ret.insert("foo".to_owned(), "bar".to_owned());
|
2456 2561 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
2457 2562 | ret
|
2458 2563 | })),
|
2459 2564 | };
|
2460 2565 | use ::aws_smithy_http_server::response::IntoResponse;
|
2461 2566 | let http_response = output.into_response();
|
2462 2567 | ::pretty_assertions::assert_eq!(
|
2463 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2568 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2464 2569 | http_response.status()
|
2465 2570 | );
|
2466 2571 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2467 2572 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2468 2573 | http_response.headers(),
|
2469 2574 | expected_headers,
|
2470 2575 | ));
|
2471 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2576 + | use ::http_body_util::BodyExt;
|
2577 + | let body = http_response
|
2578 + | .into_body()
|
2579 + | .collect()
|
2472 2580 | .await
|
2473 - | .expect("unable to extract body to bytes");
|
2581 + | .expect("unable to collect body")
|
2582 + | .to_bytes();
|
2474 2583 | ::aws_smithy_protocol_test::assert_ok(
|
2475 2584 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2476 2585 | );
|
2477 2586 | }
|
2478 2587 |
|
2479 2588 | /// Deserializes a structure union value
|
2480 2589 | /// Test ID: AwsJson10DeserializeStructureUnionValue
|
2481 2590 | #[::tokio::test]
|
2482 2591 | #[::tracing_test::traced_test]
|
2483 2592 | async fn aws_json10_deserialize_structure_union_value_response() {
|
2484 2593 | let output = crate::output::JsonUnionsOutput {
|
2485 2594 | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
2486 2595 | crate::model::GreetingStruct {
|
2487 2596 | hi: ::std::option::Option::Some("hello".to_owned()),
|
2488 2597 | },
|
2489 2598 | )),
|
2490 2599 | };
|
2491 2600 | use ::aws_smithy_http_server::response::IntoResponse;
|
2492 2601 | let http_response = output.into_response();
|
2493 2602 | ::pretty_assertions::assert_eq!(
|
2494 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2603 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2495 2604 | http_response.status()
|
2496 2605 | );
|
2497 2606 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2498 2607 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2499 2608 | http_response.headers(),
|
2500 2609 | expected_headers,
|
2501 2610 | ));
|
2502 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2611 + | use ::http_body_util::BodyExt;
|
2612 + | let body = http_response
|
2613 + | .into_body()
|
2614 + | .collect()
|
2503 2615 | .await
|
2504 - | .expect("unable to extract body to bytes");
|
2616 + | .expect("unable to collect body")
|
2617 + | .to_bytes();
|
2505 2618 | ::aws_smithy_protocol_test::assert_ok(
|
2506 2619 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2507 2620 | );
|
2508 2621 | }
|
2509 2622 | }
|
2510 2623 |
|
2511 2624 | ::pin_project_lite::pin_project! {
|
2512 2625 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2513 2626 | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
2514 2627 | pub struct GreetingWithErrorsInputFuture {
|
2515 2628 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2516 2629 | }
|
2517 2630 | }
|
2518 2631 |
|
2519 2632 | impl std::future::Future for GreetingWithErrorsInputFuture {
|
2520 2633 | type Output = Result<
|
2521 2634 | crate::input::GreetingWithErrorsInput,
|
2522 2635 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2523 2636 | >;
|
2524 2637 |
|
2525 2638 | fn poll(
|
2526 2639 | self: std::pin::Pin<&mut Self>,
|
2527 2640 | cx: &mut std::task::Context<'_>,
|
2528 2641 | ) -> std::task::Poll<Self::Output> {
|
2529 2642 | let this = self.project();
|
2530 2643 | this.inner.as_mut().poll(cx)
|
2531 2644 | }
|
2532 2645 | }
|
2533 2646 |
|
2534 2647 | impl<B>
|
2535 2648 | ::aws_smithy_http_server::request::FromRequest<
|
2536 2649 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
2537 2650 | B,
|
2538 2651 | > for crate::input::GreetingWithErrorsInput
|
2539 2652 | where
|
2540 2653 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2541 2654 | B: 'static,
|
2542 2655 |
|
2543 2656 | B::Data: Send,
|
2544 2657 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2545 2658 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2546 2659 | {
|
2547 2660 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2548 2661 | type Future = GreetingWithErrorsInputFuture;
|
2549 2662 |
|
2550 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2663 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2551 2664 | let fut = async move {
|
2552 2665 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2553 2666 | request.headers(),
|
2554 2667 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_0,
|
2555 2668 | ) {
|
2556 2669 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2557 2670 | }
|
2558 2671 | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
2559 2672 | request,
|
2560 2673 | )
|
2625 2738 | #[::tokio::test]
|
2626 2739 | #[::tracing_test::traced_test]
|
2627 2740 | async fn aws_json10_invalid_greeting_error_response() {
|
2628 2741 | let output = crate::error::InvalidGreeting {
|
2629 2742 | message: ::std::option::Option::Some("Hi".to_owned()),
|
2630 2743 | };
|
2631 2744 | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
2632 2745 | use ::aws_smithy_http_server::response::IntoResponse;
|
2633 2746 | let http_response = output.into_response();
|
2634 2747 | ::pretty_assertions::assert_eq!(
|
2635 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2748 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2636 2749 | http_response.status()
|
2637 2750 | );
|
2638 2751 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2639 2752 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2640 2753 | http_response.headers(),
|
2641 2754 | expected_headers,
|
2642 2755 | ));
|
2643 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2756 + | use ::http_body_util::BodyExt;
|
2757 + | let body = http_response
|
2758 + | .into_body()
|
2759 + | .collect()
|
2644 2760 | .await
|
2645 - | .expect("unable to extract body to bytes");
|
2761 + | .expect("unable to collect body")
|
2762 + | .to_bytes();
|
2646 2763 | ::aws_smithy_protocol_test::assert_ok(
|
2647 2764 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"__type\": \"aws.protocoltests.json10#InvalidGreeting\",\n \"Message\": \"Hi\"\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2648 2765 | );
|
2649 2766 | }
|
2650 2767 |
|
2651 2768 | /// Parses a complex error with no message member
|
2652 2769 | /// Test ID: AwsJson10ComplexError
|
2653 2770 | #[::tokio::test]
|
2654 2771 | #[::tracing_test::traced_test]
|
2655 2772 | async fn aws_json10_complex_error_response() {
|
2656 2773 | let output = crate::error::ComplexError {
|
2657 2774 | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
2658 2775 | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
2659 2776 | foo: ::std::option::Option::Some("bar".to_owned()),
|
2660 2777 | }),
|
2661 2778 | };
|
2662 2779 | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
2663 2780 | use ::aws_smithy_http_server::response::IntoResponse;
|
2664 2781 | let http_response = output.into_response();
|
2665 2782 | ::pretty_assertions::assert_eq!(
|
2666 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2783 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2667 2784 | http_response.status()
|
2668 2785 | );
|
2669 2786 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2670 2787 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2671 2788 | http_response.headers(),
|
2672 2789 | expected_headers,
|
2673 2790 | ));
|
2674 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2791 + | use ::http_body_util::BodyExt;
|
2792 + | let body = http_response
|
2793 + | .into_body()
|
2794 + | .collect()
|
2675 2795 | .await
|
2676 - | .expect("unable to extract body to bytes");
|
2796 + | .expect("unable to collect body")
|
2797 + | .to_bytes();
|
2677 2798 | ::aws_smithy_protocol_test::assert_ok(
|
2678 2799 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"__type\": \"aws.protocoltests.json10#ComplexError\",\n \"TopLevel\": \"Top level\",\n \"Nested\": {\n \"Foo\": \"bar\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2679 2800 | );
|
2680 2801 | }
|
2681 2802 |
|
2682 2803 | /// Parses a complex error with an empty body
|
2683 2804 | /// Test ID: AwsJson10EmptyComplexError
|
2684 2805 | #[::tokio::test]
|
2685 2806 | #[::tracing_test::traced_test]
|
2686 2807 | async fn aws_json10_empty_complex_error_response() {
|
2687 2808 | let output = crate::error::ComplexError {
|
2688 2809 | top_level: ::std::option::Option::None,
|
2689 2810 | nested: ::std::option::Option::None,
|
2690 2811 | };
|
2691 2812 | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
2692 2813 | use ::aws_smithy_http_server::response::IntoResponse;
|
2693 2814 | let http_response = output.into_response();
|
2694 2815 | ::pretty_assertions::assert_eq!(
|
2695 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2816 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2696 2817 | http_response.status()
|
2697 2818 | );
|
2698 2819 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
2699 2820 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2700 2821 | http_response.headers(),
|
2701 2822 | expected_headers,
|
2702 2823 | ));
|
2703 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2824 + | use ::http_body_util::BodyExt;
|
2825 + | let body = http_response
|
2826 + | .into_body()
|
2827 + | .collect()
|
2704 2828 | .await
|
2705 - | .expect("unable to extract body to bytes");
|
2829 + | .expect("unable to collect body")
|
2830 + | .to_bytes();
|
2706 2831 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2707 2832 | &body,
|
2708 2833 | "{\n \"__type\": \"aws.protocoltests.json10#ComplexError\"\n}",
|
2709 2834 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2710 2835 | ));
|
2711 2836 | }
|
2712 2837 | }
|
2713 2838 |
|
2714 2839 | ::pin_project_lite::pin_project! {
|
2715 2840 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2716 2841 | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
2717 2842 | pub struct SimpleScalarPropertiesInputFuture {
|
2718 2843 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2719 2844 | }
|
2720 2845 | }
|
2721 2846 |
|
2722 2847 | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
2723 2848 | type Output = Result<
|
2724 2849 | crate::input::SimpleScalarPropertiesInput,
|
2725 2850 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2726 2851 | >;
|
2727 2852 |
|
2728 2853 | fn poll(
|
2729 2854 | self: std::pin::Pin<&mut Self>,
|
2730 2855 | cx: &mut std::task::Context<'_>,
|
2731 2856 | ) -> std::task::Poll<Self::Output> {
|
2732 2857 | let this = self.project();
|
2733 2858 | this.inner.as_mut().poll(cx)
|
2734 2859 | }
|
2735 2860 | }
|
2736 2861 |
|
2737 2862 | impl<B>
|
2738 2863 | ::aws_smithy_http_server::request::FromRequest<
|
2739 2864 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
2740 2865 | B,
|
2741 2866 | > for crate::input::SimpleScalarPropertiesInput
|
2742 2867 | where
|
2743 2868 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2744 2869 | B: 'static,
|
2745 2870 |
|
2746 2871 | B::Data: Send,
|
2747 2872 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2748 2873 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2749 2874 | {
|
2750 2875 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2751 2876 | type Future = SimpleScalarPropertiesInputFuture;
|
2752 2877 |
|
2753 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2878 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2754 2879 | let fut = async move {
|
2755 2880 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2756 2881 | request.headers(),
|
2757 2882 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_0,
|
2758 2883 | ) {
|
2759 2884 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2760 2885 | }
|
2761 2886 | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
2762 2887 | .await
|
2763 2888 | };
|
2764 2889 | use ::futures_util::future::TryFutureExt;
|
2765 2890 | let fut = fut.map_err(
|
2766 2891 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2767 2892 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2768 2893 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2769 2894 | },
|
2770 2895 | );
|
2771 2896 | SimpleScalarPropertiesInputFuture {
|
2772 2897 | inner: Box::pin(fut),
|
2773 2898 | }
|
2774 2899 | }
|
2775 2900 | }
|
2776 2901 | impl
|
2777 2902 | ::aws_smithy_http_server::response::IntoResponse<
|
2778 2903 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
2779 2904 | > for crate::output::SimpleScalarPropertiesOutput
|
2780 2905 | {
|
2781 2906 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2782 2907 | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
2783 2908 | Ok(response) => response,
|
2784 2909 | Err(e) => {
|
2785 2910 | ::tracing::error!(error = %e, "failed to serialize response");
|
2786 2911 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2787 2912 | }
|
2788 2913 | }
|
2789 2914 | }
|
2790 2915 | }
|
2791 2916 |
|
2792 2917 | #[allow(unreachable_code, unused_variables)]
|
2793 2918 | #[cfg(test)]
|
2794 2919 | mod simple_scalar_properties_test {
|
2795 2920 |
|
2796 2921 | /// Supports handling NaN float values.
|
2797 2922 | /// Test ID: AwsJson10SupportsNaNFloatInputs
|
2798 2923 | #[::tokio::test]
|
2799 2924 | #[::tracing_test::traced_test]
|
2800 2925 | async fn aws_json10_supports_na_n_float_inputs_request() {
|
2801 2926 | #[allow(unused_mut)]
|
2802 - | let mut http_request = http::Request::builder()
|
2927 + | let mut http_request = ::http_1x::Request::builder()
|
2803 2928 | .uri("/")
|
2804 2929 | .method("POST")
|
2805 2930 | .header("Content-Type", "application/x-amz-json-1.0")
|
2806 2931 | .header("X-Amz-Target", "JsonRpc10.SimpleScalarProperties")
|
2807 - | .body(::aws_smithy_http_server::body::Body::from(
|
2808 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2809 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
2932 + | .body(::aws_smithy_http_server::body::boxed(
|
2933 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2934 + | &::aws_smithy_protocol_test::decode_body_data(
|
2935 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}"
|
2936 + | .as_bytes(),
|
2810 2937 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2938 + | ),
|
2811 2939 | )),
|
2812 2940 | ))
|
2813 2941 | .unwrap();
|
2814 2942 | #[allow(unused_mut)]
|
2815 2943 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2816 2944 | let config = crate::service::JsonRpc10Config::builder().build();
|
2817 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
2945 + | let service = crate::service::JsonRpc10::builder::<
|
2946 + | ::aws_smithy_http_server::body::BoxBody,
|
2947 + | _,
|
2948 + | _,
|
2949 + | _,
|
2950 + | >(config)
|
2818 2951 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
2819 2952 | let sender = sender.clone();
|
2820 2953 | async move {
|
2821 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
2822 - | let expected =
|
2823 - | crate::input::SimpleScalarPropertiesInput {
|
2824 - | float_value:
|
2825 - | ::std::option::Option::Some(
|
2826 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
2954 + | let result = {
|
2955 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2956 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
2957 + | float_value: ::std::option::Option::Some(
|
2958 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
2959 + | "NaN",
|
2827 2960 | )
|
2828 - | ,
|
2829 - | double_value:
|
2830 - | ::std::option::Option::Some(
|
2831 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
2961 + | .expect("invalid string for number"),
|
2962 + | ),
|
2963 + | double_value: ::std::option::Option::Some(
|
2964 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
2965 + | "NaN",
|
2832 2966 | )
|
2833 - | ,
|
2834 - | }
|
2835 - | ;
|
2836 - | assert!(input.float_value.float_equals(&expected.float_value),
|
2837 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
2838 - | assert!(input.double_value.float_equals(&expected.double_value),
|
2839 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
2840 - | let output =
|
2841 - | crate::output::SimpleScalarPropertiesOutput {
|
2842 - | float_value:
|
2843 - | ::std::option::Option::None
|
2844 - | ,
|
2845 - | double_value:
|
2846 - | ::std::option::Option::None
|
2847 - | ,
|
2848 - | }
|
2849 - | ;
|
2850 - | output };
|
2967 + | .expect("invalid string for number"),
|
2968 + | ),
|
2969 + | };
|
2970 + | assert!(
|
2971 + | input.float_value.float_equals(&expected.float_value),
|
2972 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
2973 + | expected.float_value,
|
2974 + | input.float_value
|
2975 + | );
|
2976 + | assert!(
|
2977 + | input.double_value.float_equals(&expected.double_value),
|
2978 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
2979 + | expected.double_value,
|
2980 + | input.double_value
|
2981 + | );
|
2982 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
2983 + | float_value: ::std::option::Option::None,
|
2984 + | double_value: ::std::option::Option::None,
|
2985 + | };
|
2986 + | output
|
2987 + | };
|
2851 2988 | sender.send(()).await.expect("receiver dropped early");
|
2852 2989 | result
|
2853 2990 | }
|
2854 2991 | })
|
2855 2992 | .build_unchecked();
|
2856 2993 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2857 2994 | .await
|
2858 2995 | .expect("unable to make an HTTP request");
|
2859 2996 | assert!(
|
2860 2997 | receiver.recv().await.is_some(),
|
2861 2998 | "we expected operation handler to be invoked but it was not entered"
|
2862 2999 | );
|
2863 3000 | }
|
2864 3001 |
|
2865 3002 | /// Supports handling Infinity float values.
|
2866 3003 | /// Test ID: AwsJson10SupportsInfinityFloatInputs
|
2867 3004 | #[::tokio::test]
|
2868 3005 | #[::tracing_test::traced_test]
|
2869 3006 | async fn aws_json10_supports_infinity_float_inputs_request() {
|
2870 3007 | #[allow(unused_mut)]
|
2871 - | let mut http_request = http::Request::builder()
|
3008 + | let mut http_request = ::http_1x::Request::builder()
|
2872 3009 | .uri("/")
|
2873 3010 | .method("POST")
|
2874 3011 | .header("Content-Type", "application/x-amz-json-1.0")
|
2875 3012 | .header("X-Amz-Target", "JsonRpc10.SimpleScalarProperties")
|
2876 - | .body(::aws_smithy_http_server::body::Body::from(
|
2877 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2878 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
2879 - | .as_bytes(),
|
2880 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2881 - | )),
|
2882 - | ))
|
2883 - | .unwrap();
|
3013 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3014 + | ::bytes::Bytes::copy_from_slice(
|
3015 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3016 + | )
|
3017 + | ))).unwrap();
|
2884 3018 | #[allow(unused_mut)]
|
2885 3019 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2886 3020 | let config = crate::service::JsonRpc10Config::builder().build();
|
2887 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3021 + | let service = crate::service::JsonRpc10::builder::<
|
3022 + | ::aws_smithy_http_server::body::BoxBody,
|
3023 + | _,
|
3024 + | _,
|
3025 + | _,
|
3026 + | >(config)
|
2888 3027 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
2889 3028 | let sender = sender.clone();
|
2890 3029 | async move {
|
2891 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
2892 - | let expected =
|
2893 - | crate::input::SimpleScalarPropertiesInput {
|
2894 - | float_value:
|
2895 - | ::std::option::Option::Some(
|
2896 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3030 + | let result = {
|
3031 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3032 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3033 + | float_value: ::std::option::Option::Some(
|
3034 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3035 + | "Infinity",
|
2897 3036 | )
|
2898 - | ,
|
2899 - | double_value:
|
2900 - | ::std::option::Option::Some(
|
2901 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3037 + | .expect("invalid string for number"),
|
3038 + | ),
|
3039 + | double_value: ::std::option::Option::Some(
|
3040 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3041 + | "Infinity",
|
2902 3042 | )
|
2903 - | ,
|
2904 - | }
|
2905 - | ;
|
2906 - | assert!(input.float_value.float_equals(&expected.float_value),
|
2907 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
2908 - | assert!(input.double_value.float_equals(&expected.double_value),
|
2909 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
2910 - | let output =
|
2911 - | crate::output::SimpleScalarPropertiesOutput {
|
2912 - | float_value:
|
2913 - | ::std::option::Option::None
|
2914 - | ,
|
2915 - | double_value:
|
2916 - | ::std::option::Option::None
|
2917 - | ,
|
2918 - | }
|
2919 - | ;
|
2920 - | output };
|
3043 + | .expect("invalid string for number"),
|
3044 + | ),
|
3045 + | };
|
3046 + | assert!(
|
3047 + | input.float_value.float_equals(&expected.float_value),
|
3048 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3049 + | expected.float_value,
|
3050 + | input.float_value
|
3051 + | );
|
3052 + | assert!(
|
3053 + | input.double_value.float_equals(&expected.double_value),
|
3054 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3055 + | expected.double_value,
|
3056 + | input.double_value
|
3057 + | );
|
3058 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3059 + | float_value: ::std::option::Option::None,
|
3060 + | double_value: ::std::option::Option::None,
|
3061 + | };
|
3062 + | output
|
3063 + | };
|
2921 3064 | sender.send(()).await.expect("receiver dropped early");
|
2922 3065 | result
|
2923 3066 | }
|
2924 3067 | })
|
2925 3068 | .build_unchecked();
|
2926 3069 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2927 3070 | .await
|
2928 3071 | .expect("unable to make an HTTP request");
|
2929 3072 | assert!(
|
2930 3073 | receiver.recv().await.is_some(),
|
2931 3074 | "we expected operation handler to be invoked but it was not entered"
|
2932 3075 | );
|
2933 3076 | }
|
2934 3077 |
|
2935 3078 | /// Supports handling -Infinity float values.
|
2936 3079 | /// Test ID: AwsJson10SupportsNegativeInfinityFloatInputs
|
2937 3080 | #[::tokio::test]
|
2938 3081 | #[::tracing_test::traced_test]
|
2939 3082 | async fn aws_json10_supports_negative_infinity_float_inputs_request() {
|
2940 3083 | #[allow(unused_mut)]
|
2941 - | let mut http_request = http::Request::builder()
|
3084 + | let mut http_request = ::http_1x::Request::builder()
|
2942 3085 | .uri("/")
|
2943 3086 | .method("POST")
|
2944 3087 | .header("Content-Type", "application/x-amz-json-1.0")
|
2945 3088 | .header("X-Amz-Target", "JsonRpc10.SimpleScalarProperties")
|
2946 - | .body(::aws_smithy_http_server::body::Body::from(
|
2947 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2948 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
2949 - | .as_bytes(),
|
2950 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2951 - | )),
|
2952 - | ))
|
2953 - | .unwrap();
|
3089 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3090 + | ::bytes::Bytes::copy_from_slice(
|
3091 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3092 + | )
|
3093 + | ))).unwrap();
|
2954 3094 | #[allow(unused_mut)]
|
2955 3095 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2956 3096 | let config = crate::service::JsonRpc10Config::builder().build();
|
2957 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3097 + | let service = crate::service::JsonRpc10::builder::<
|
3098 + | ::aws_smithy_http_server::body::BoxBody,
|
3099 + | _,
|
3100 + | _,
|
3101 + | _,
|
3102 + | >(config)
|
2958 3103 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
2959 3104 | let sender = sender.clone();
|
2960 3105 | async move {
|
2961 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
2962 - | let expected =
|
2963 - | crate::input::SimpleScalarPropertiesInput {
|
2964 - | float_value:
|
2965 - | ::std::option::Option::Some(
|
2966 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3106 + | let result = {
|
3107 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3108 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3109 + | float_value: ::std::option::Option::Some(
|
3110 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3111 + | "-Infinity",
|
2967 3112 | )
|
2968 - | ,
|
2969 - | double_value:
|
2970 - | ::std::option::Option::Some(
|
2971 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3113 + | .expect("invalid string for number"),
|
3114 + | ),
|
3115 + | double_value: ::std::option::Option::Some(
|
3116 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3117 + | "-Infinity",
|
2972 3118 | )
|
2973 - | ,
|
2974 - | }
|
2975 - | ;
|
2976 - | assert!(input.float_value.float_equals(&expected.float_value),
|
2977 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
2978 - | assert!(input.double_value.float_equals(&expected.double_value),
|
2979 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
2980 - | let output =
|
2981 - | crate::output::SimpleScalarPropertiesOutput {
|
2982 - | float_value:
|
2983 - | ::std::option::Option::None
|
2984 - | ,
|
2985 - | double_value:
|
2986 - | ::std::option::Option::None
|
2987 - | ,
|
2988 - | }
|
2989 - | ;
|
2990 - | output };
|
3119 + | .expect("invalid string for number"),
|
3120 + | ),
|
3121 + | };
|
3122 + | assert!(
|
3123 + | input.float_value.float_equals(&expected.float_value),
|
3124 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3125 + | expected.float_value,
|
3126 + | input.float_value
|
3127 + | );
|
3128 + | assert!(
|
3129 + | input.double_value.float_equals(&expected.double_value),
|
3130 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3131 + | expected.double_value,
|
3132 + | input.double_value
|
3133 + | );
|
3134 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3135 + | float_value: ::std::option::Option::None,
|
3136 + | double_value: ::std::option::Option::None,
|
3137 + | };
|
3138 + | output
|
3139 + | };
|
2991 3140 | sender.send(()).await.expect("receiver dropped early");
|
2992 3141 | result
|
2993 3142 | }
|
2994 3143 | })
|
2995 3144 | .build_unchecked();
|
2996 3145 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2997 3146 | .await
|
2998 3147 | .expect("unable to make an HTTP request");
|
2999 3148 | assert!(
|
3000 3149 | receiver.recv().await.is_some(),
|
3001 3150 | "we expected operation handler to be invoked but it was not entered"
|
3002 3151 | );
|
3003 3152 | }
|
3004 3153 |
|
3005 3154 | /// Supports handling NaN float values.
|
3006 3155 | /// Test ID: AwsJson10SupportsNaNFloatInputs
|
3007 3156 | #[::tokio::test]
|
3008 3157 | #[::tracing_test::traced_test]
|
3009 3158 | async fn aws_json10_supports_na_n_float_inputs_response() {
|
3010 3159 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3011 3160 | float_value: ::std::option::Option::Some(
|
3012 3161 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3013 3162 | .expect("invalid string for number"),
|
3014 3163 | ),
|
3015 3164 | double_value: ::std::option::Option::Some(
|
3016 3165 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3017 3166 | .expect("invalid string for number"),
|
3018 3167 | ),
|
3019 3168 | };
|
3020 3169 | use ::aws_smithy_http_server::response::IntoResponse;
|
3021 3170 | let http_response = output.into_response();
|
3022 3171 | ::pretty_assertions::assert_eq!(
|
3023 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3172 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3024 3173 | http_response.status()
|
3025 3174 | );
|
3026 3175 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3027 3176 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3028 3177 | http_response.headers(),
|
3029 3178 | expected_headers,
|
3030 3179 | ));
|
3031 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3180 + | use ::http_body_util::BodyExt;
|
3181 + | let body = http_response
|
3182 + | .into_body()
|
3183 + | .collect()
|
3032 3184 | .await
|
3033 - | .expect("unable to extract body to bytes");
|
3185 + | .expect("unable to collect body")
|
3186 + | .to_bytes();
|
3034 3187 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3035 3188 | &body,
|
3036 3189 | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3037 3190 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3038 3191 | ));
|
3039 3192 | }
|
3040 3193 |
|
3041 3194 | /// Supports handling Infinity float values.
|
3042 3195 | /// Test ID: AwsJson10SupportsInfinityFloatInputs
|
3043 3196 | #[::tokio::test]
|
3044 3197 | #[::tracing_test::traced_test]
|
3045 3198 | async fn aws_json10_supports_infinity_float_inputs_response() {
|
3046 3199 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3047 3200 | float_value: ::std::option::Option::Some(
|
3048 3201 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3049 3202 | .expect("invalid string for number"),
|
3050 3203 | ),
|
3051 3204 | double_value: ::std::option::Option::Some(
|
3052 3205 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3053 3206 | .expect("invalid string for number"),
|
3054 3207 | ),
|
3055 3208 | };
|
3056 3209 | use ::aws_smithy_http_server::response::IntoResponse;
|
3057 3210 | let http_response = output.into_response();
|
3058 3211 | ::pretty_assertions::assert_eq!(
|
3059 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3212 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3060 3213 | http_response.status()
|
3061 3214 | );
|
3062 3215 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3063 3216 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3064 3217 | http_response.headers(),
|
3065 3218 | expected_headers,
|
3066 3219 | ));
|
3067 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3220 + | use ::http_body_util::BodyExt;
|
3221 + | let body = http_response
|
3222 + | .into_body()
|
3223 + | .collect()
|
3068 3224 | .await
|
3069 - | .expect("unable to extract body to bytes");
|
3225 + | .expect("unable to collect body")
|
3226 + | .to_bytes();
|
3070 3227 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3071 3228 | &body,
|
3072 3229 | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3073 3230 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3074 3231 | ));
|
3075 3232 | }
|
3076 3233 |
|
3077 3234 | /// Supports handling -Infinity float values.
|
3078 3235 | /// Test ID: AwsJson10SupportsNegativeInfinityFloatInputs
|
3079 3236 | #[::tokio::test]
|
3080 3237 | #[::tracing_test::traced_test]
|
3081 3238 | async fn aws_json10_supports_negative_infinity_float_inputs_response() {
|
3082 3239 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3083 3240 | float_value: ::std::option::Option::Some(
|
3084 3241 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3085 3242 | .expect("invalid string for number"),
|
3086 3243 | ),
|
3087 3244 | double_value: ::std::option::Option::Some(
|
3088 3245 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3089 3246 | .expect("invalid string for number"),
|
3090 3247 | ),
|
3091 3248 | };
|
3092 3249 | use ::aws_smithy_http_server::response::IntoResponse;
|
3093 3250 | let http_response = output.into_response();
|
3094 3251 | ::pretty_assertions::assert_eq!(
|
3095 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3252 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3096 3253 | http_response.status()
|
3097 3254 | );
|
3098 3255 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3099 3256 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3100 3257 | http_response.headers(),
|
3101 3258 | expected_headers,
|
3102 3259 | ));
|
3103 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3260 + | use ::http_body_util::BodyExt;
|
3261 + | let body = http_response
|
3262 + | .into_body()
|
3263 + | .collect()
|
3104 3264 | .await
|
3105 - | .expect("unable to extract body to bytes");
|
3265 + | .expect("unable to collect body")
|
3266 + | .to_bytes();
|
3106 3267 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3107 3268 | &body,
|
3108 3269 | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3109 3270 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3110 3271 | ));
|
3111 3272 | }
|
3112 3273 | }
|
3113 3274 |
|
3114 3275 | ::pin_project_lite::pin_project! {
|
3115 3276 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3116 3277 | /// [`EmptyInputAndEmptyOutputInput`](crate::input::EmptyInputAndEmptyOutputInput) using modelled bindings.
|
3117 3278 | pub struct EmptyInputAndEmptyOutputInputFuture {
|
3118 3279 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyInputAndEmptyOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3119 3280 | }
|
3120 3281 | }
|
3121 3282 |
|
3122 3283 | impl std::future::Future for EmptyInputAndEmptyOutputInputFuture {
|
3123 3284 | type Output = Result<
|
3124 3285 | crate::input::EmptyInputAndEmptyOutputInput,
|
3125 3286 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3126 3287 | >;
|
3127 3288 |
|
3128 3289 | fn poll(
|
3129 3290 | self: std::pin::Pin<&mut Self>,
|
3130 3291 | cx: &mut std::task::Context<'_>,
|
3131 3292 | ) -> std::task::Poll<Self::Output> {
|
3132 3293 | let this = self.project();
|
3133 3294 | this.inner.as_mut().poll(cx)
|
3134 3295 | }
|
3135 3296 | }
|
3136 3297 |
|
3137 3298 | impl<B>
|
3138 3299 | ::aws_smithy_http_server::request::FromRequest<
|
3139 3300 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3140 3301 | B,
|
3141 3302 | > for crate::input::EmptyInputAndEmptyOutputInput
|
3142 3303 | where
|
3143 3304 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3144 3305 | B: 'static,
|
3145 3306 |
|
3146 3307 | B::Data: Send,
|
3147 3308 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3148 3309 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3149 3310 | {
|
3150 3311 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3151 3312 | type Future = EmptyInputAndEmptyOutputInputFuture;
|
3152 3313 |
|
3153 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3314 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3154 3315 | let fut = async move {
|
3155 3316 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3156 3317 | request.headers(),
|
3157 3318 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_0,
|
3158 3319 | ) {
|
3159 3320 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3160 3321 | }
|
3161 3322 | crate::protocol_serde::shape_empty_input_and_empty_output::de_empty_input_and_empty_output_http_request(request)
|
3162 3323 | .await
|
3163 3324 | };
|
3164 3325 | use ::futures_util::future::TryFutureExt;
|
3165 3326 | let fut = fut.map_err(
|
3166 3327 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3167 3328 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3168 3329 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3169 3330 | },
|
3170 3331 | );
|
3171 3332 | EmptyInputAndEmptyOutputInputFuture {
|
3172 3333 | inner: Box::pin(fut),
|
3173 3334 | }
|
3174 3335 | }
|
3175 3336 | }
|
3176 3337 | impl
|
3177 3338 | ::aws_smithy_http_server::response::IntoResponse<
|
3178 3339 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3179 3340 | > for crate::output::EmptyInputAndEmptyOutputOutput
|
3180 3341 | {
|
3181 3342 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3182 3343 | match crate::protocol_serde::shape_empty_input_and_empty_output::ser_empty_input_and_empty_output_http_response(self) {
|
3183 3344 | Ok(response) => response,
|
3184 3345 | Err(e) => {
|
3185 3346 | ::tracing::error!(error = %e, "failed to serialize response");
|
3186 3347 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3187 3348 | }
|
3188 3349 | }
|
3189 3350 | }
|
3190 3351 | }
|
3191 3352 |
|
3192 3353 | #[allow(unreachable_code, unused_variables)]
|
3193 3354 | #[cfg(test)]
|
3194 3355 | mod empty_input_and_empty_output_test {
|
3195 3356 |
|
3196 3357 | /// Clients must always send an empty object if input is modeled.
|
3197 3358 | /// Test ID: AwsJson10EmptyInputAndEmptyOutput
|
3198 3359 | #[::tokio::test]
|
3199 3360 | #[::tracing_test::traced_test]
|
3200 3361 | async fn aws_json10_empty_input_and_empty_output_request() {
|
3201 3362 | #[allow(unused_mut)]
|
3202 - | let mut http_request = http::Request::builder()
|
3363 + | let mut http_request = ::http_1x::Request::builder()
|
3203 3364 | .uri("/")
|
3204 3365 | .method("POST")
|
3205 3366 | .header("Content-Type", "application/x-amz-json-1.0")
|
3206 3367 | .header("X-Amz-Target", "JsonRpc10.EmptyInputAndEmptyOutput")
|
3207 - | .body(::aws_smithy_http_server::body::Body::from(
|
3208 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3368 + | .body(::aws_smithy_http_server::body::boxed(
|
3369 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3370 + | &::aws_smithy_protocol_test::decode_body_data(
|
3209 3371 | "{}".as_bytes(),
|
3210 3372 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3373 + | ),
|
3211 3374 | )),
|
3212 3375 | ))
|
3213 3376 | .unwrap();
|
3214 3377 | #[allow(unused_mut)]
|
3215 3378 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3216 3379 | let config = crate::service::JsonRpc10Config::builder().build();
|
3217 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3218 - | .empty_input_and_empty_output(
|
3219 - | move |input: crate::input::EmptyInputAndEmptyOutputInput| {
|
3380 + | let service = crate::service::JsonRpc10::builder::<
|
3381 + | ::aws_smithy_http_server::body::BoxBody,
|
3382 + | _,
|
3383 + | _,
|
3384 + | _,
|
3385 + | >(config)
|
3386 + | .empty_input_and_empty_output(move |input: crate::input::EmptyInputAndEmptyOutputInput| {
|
3220 3387 | let sender = sender.clone();
|
3221 3388 | async move {
|
3222 3389 | let result = {
|
3223 3390 | let expected = crate::input::EmptyInputAndEmptyOutputInput {};
|
3224 3391 | ::pretty_assertions::assert_eq!(input, expected);
|
3225 3392 | let output = crate::output::EmptyInputAndEmptyOutputOutput {};
|
3226 3393 | output
|
3227 3394 | };
|
3228 3395 | sender.send(()).await.expect("receiver dropped early");
|
3229 3396 | result
|
3230 3397 | }
|
3231 - | },
|
3232 - | )
|
3398 + | })
|
3233 3399 | .build_unchecked();
|
3234 3400 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3235 3401 | .await
|
3236 3402 | .expect("unable to make an HTTP request");
|
3237 3403 | assert!(
|
3238 3404 | receiver.recv().await.is_some(),
|
3239 3405 | "we expected operation handler to be invoked but it was not entered"
|
3240 3406 | );
|
3241 3407 | }
|
3242 3408 |
|
3243 3409 | /// A service will always return a JSON object for operations with modeled output.
|
3244 3410 | /// Test ID: AwsJson10EmptyInputAndEmptyOutputSendJsonObject
|
3245 3411 | #[::tokio::test]
|
3246 3412 | #[::tracing_test::traced_test]
|
3247 3413 | async fn aws_json10_empty_input_and_empty_output_send_json_object_response() {
|
3248 3414 | let output = crate::output::EmptyInputAndEmptyOutputOutput {};
|
3249 3415 | use ::aws_smithy_http_server::response::IntoResponse;
|
3250 3416 | let http_response = output.into_response();
|
3251 3417 | ::pretty_assertions::assert_eq!(
|
3252 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3418 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3253 3419 | http_response.status()
|
3254 3420 | );
|
3255 3421 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3256 3422 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3257 3423 | http_response.headers(),
|
3258 3424 | expected_headers,
|
3259 3425 | ));
|
3260 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3426 + | use ::http_body_util::BodyExt;
|
3427 + | let body = http_response
|
3428 + | .into_body()
|
3429 + | .collect()
|
3261 3430 | .await
|
3262 - | .expect("unable to extract body to bytes");
|
3431 + | .expect("unable to collect body")
|
3432 + | .to_bytes();
|
3263 3433 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3264 3434 | &body,
|
3265 3435 | "{}",
|
3266 3436 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3267 3437 | ));
|
3268 3438 | }
|
3269 3439 | }
|
3270 3440 |
|
3271 3441 | ::pin_project_lite::pin_project! {
|
3272 3442 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3273 3443 | /// [`NoInputAndOutputInput`](crate::input::NoInputAndOutputInput) using modelled bindings.
|
3274 3444 | pub struct NoInputAndOutputInputFuture {
|
3275 3445 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NoInputAndOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3276 3446 | }
|
3277 3447 | }
|
3278 3448 |
|
3279 3449 | impl std::future::Future for NoInputAndOutputInputFuture {
|
3280 3450 | type Output = Result<
|
3281 3451 | crate::input::NoInputAndOutputInput,
|
3282 3452 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3283 3453 | >;
|
3284 3454 |
|
3285 3455 | fn poll(
|
3286 3456 | self: std::pin::Pin<&mut Self>,
|
3287 3457 | cx: &mut std::task::Context<'_>,
|
3288 3458 | ) -> std::task::Poll<Self::Output> {
|
3289 3459 | let this = self.project();
|
3290 3460 | this.inner.as_mut().poll(cx)
|
3291 3461 | }
|
3292 3462 | }
|
3293 3463 |
|
3294 3464 | impl<B>
|
3295 3465 | ::aws_smithy_http_server::request::FromRequest<
|
3296 3466 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3297 3467 | B,
|
3298 3468 | > for crate::input::NoInputAndOutputInput
|
3299 3469 | where
|
3300 3470 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3301 3471 | B: 'static,
|
3302 3472 |
|
3303 3473 | B::Data: Send,
|
3304 3474 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3305 3475 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3306 3476 | {
|
3307 3477 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3308 3478 | type Future = NoInputAndOutputInputFuture;
|
3309 3479 |
|
3310 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3480 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3311 3481 | let fut = async move {
|
3312 3482 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3313 3483 | request.headers(),
|
3314 3484 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_0,
|
3315 3485 | ) {
|
3316 3486 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3317 3487 | }
|
3318 3488 | crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_http_request(
|
3319 3489 | request,
|
3320 3490 | )
|
3321 3491 | .await
|
3322 3492 | };
|
3323 3493 | use ::futures_util::future::TryFutureExt;
|
3324 3494 | let fut = fut.map_err(
|
3325 3495 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3326 3496 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3327 3497 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3328 3498 | },
|
3329 3499 | );
|
3330 3500 | NoInputAndOutputInputFuture {
|
3331 3501 | inner: Box::pin(fut),
|
3332 3502 | }
|
3333 3503 | }
|
3334 3504 | }
|
3335 3505 | impl
|
3336 3506 | ::aws_smithy_http_server::response::IntoResponse<
|
3337 3507 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3338 3508 | > for crate::output::NoInputAndOutputOutput
|
3339 3509 | {
|
3340 3510 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3341 3511 | match crate::protocol_serde::shape_no_input_and_output::ser_no_input_and_output_http_response(self) {
|
3342 3512 | Ok(response) => response,
|
3343 3513 | Err(e) => {
|
3344 3514 | ::tracing::error!(error = %e, "failed to serialize response");
|
3345 3515 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3346 3516 | }
|
3347 3517 | }
|
3348 3518 | }
|
3349 3519 | }
|
3350 3520 |
|
3351 3521 | #[allow(unreachable_code, unused_variables)]
|
3352 3522 | #[cfg(test)]
|
3353 3523 | mod no_input_and_output_test {
|
3354 3524 |
|
3355 3525 | /// A client should always send and empty JSON object payload.
|
3356 3526 | /// Test ID: AwsJson10NoInputAndOutput
|
3357 3527 | #[::tokio::test]
|
3358 3528 | #[::tracing_test::traced_test]
|
3359 3529 | async fn aws_json10_no_input_and_output_request() {
|
3360 3530 | #[allow(unused_mut)]
|
3361 - | let mut http_request = http::Request::builder()
|
3531 + | let mut http_request = ::http_1x::Request::builder()
|
3362 3532 | .uri("/")
|
3363 3533 | .method("POST")
|
3364 3534 | .header("Content-Type", "application/x-amz-json-1.0")
|
3365 3535 | .header("X-Amz-Target", "JsonRpc10.NoInputAndOutput")
|
3366 - | .body(::aws_smithy_http_server::body::Body::from(
|
3367 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3536 + | .body(::aws_smithy_http_server::body::boxed(
|
3537 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3538 + | &::aws_smithy_protocol_test::decode_body_data(
|
3368 3539 | "{}".as_bytes(),
|
3369 3540 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3541 + | ),
|
3370 3542 | )),
|
3371 3543 | ))
|
3372 3544 | .unwrap();
|
3373 3545 | #[allow(unused_mut)]
|
3374 3546 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3375 3547 | let config = crate::service::JsonRpc10Config::builder().build();
|
3376 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3548 + | let service =
|
3549 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
3550 + | config,
|
3551 + | )
|
3377 3552 | .no_input_and_output(move |input: crate::input::NoInputAndOutputInput| {
|
3378 3553 | let sender = sender.clone();
|
3379 3554 | async move {
|
3380 3555 | let result = {
|
3381 3556 | let expected = crate::input::NoInputAndOutputInput {};
|
3382 3557 | ::pretty_assertions::assert_eq!(input, expected);
|
3383 3558 | let output = crate::output::NoInputAndOutputOutput {};
|
3384 3559 | output
|
3385 3560 | };
|
3386 3561 | sender.send(()).await.expect("receiver dropped early");
|
3387 3562 | result
|
3388 3563 | }
|
3389 3564 | })
|
3390 3565 | .build_unchecked();
|
3391 3566 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3392 3567 | .await
|
3393 3568 | .expect("unable to make an HTTP request");
|
3394 3569 | assert!(
|
3395 3570 | receiver.recv().await.is_some(),
|
3396 3571 | "we expected operation handler to be invoked but it was not entered"
|
3397 3572 | );
|
3398 3573 | }
|
3399 3574 |
|
3400 3575 | /// Empty output always serializes an empty object payload.
|
3401 3576 | /// Test ID: AwsJson10NoInputAndOutput
|
3402 3577 | #[::tokio::test]
|
3403 3578 | #[::tracing_test::traced_test]
|
3404 3579 | async fn aws_json10_no_input_and_output_response() {
|
3405 3580 | let output = crate::output::NoInputAndOutputOutput {};
|
3406 3581 | use ::aws_smithy_http_server::response::IntoResponse;
|
3407 3582 | let http_response = output.into_response();
|
3408 3583 | ::pretty_assertions::assert_eq!(
|
3409 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3584 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3410 3585 | http_response.status()
|
3411 3586 | );
|
3412 3587 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3413 3588 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3414 3589 | http_response.headers(),
|
3415 3590 | expected_headers,
|
3416 3591 | ));
|
3417 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3592 + | use ::http_body_util::BodyExt;
|
3593 + | let body = http_response
|
3594 + | .into_body()
|
3595 + | .collect()
|
3418 3596 | .await
|
3419 - | .expect("unable to extract body to bytes");
|
3597 + | .expect("unable to collect body")
|
3598 + | .to_bytes();
|
3420 3599 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3421 3600 | &body,
|
3422 3601 | "{}",
|
3423 3602 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3424 3603 | ));
|
3425 3604 | }
|
3426 3605 | }
|
3427 3606 |
|
3428 3607 | ::pin_project_lite::pin_project! {
|
3429 3608 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3430 3609 | /// [`NoInputAndNoOutputInput`](crate::input::NoInputAndNoOutputInput) using modelled bindings.
|
3431 3610 | pub struct NoInputAndNoOutputInputFuture {
|
3432 3611 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NoInputAndNoOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3433 3612 | }
|
3434 3613 | }
|
3435 3614 |
|
3436 3615 | impl std::future::Future for NoInputAndNoOutputInputFuture {
|
3437 3616 | type Output = Result<
|
3438 3617 | crate::input::NoInputAndNoOutputInput,
|
3439 3618 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3440 3619 | >;
|
3441 3620 |
|
3442 3621 | fn poll(
|
3443 3622 | self: std::pin::Pin<&mut Self>,
|
3444 3623 | cx: &mut std::task::Context<'_>,
|
3445 3624 | ) -> std::task::Poll<Self::Output> {
|
3446 3625 | let this = self.project();
|
3447 3626 | this.inner.as_mut().poll(cx)
|
3448 3627 | }
|
3449 3628 | }
|
3450 3629 |
|
3451 3630 | impl<B>
|
3452 3631 | ::aws_smithy_http_server::request::FromRequest<
|
3453 3632 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3454 3633 | B,
|
3455 3634 | > for crate::input::NoInputAndNoOutputInput
|
3456 3635 | where
|
3457 3636 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3458 3637 | B: 'static,
|
3459 3638 |
|
3460 3639 | B::Data: Send,
|
3461 3640 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3462 3641 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3463 3642 | {
|
3464 3643 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3465 3644 | type Future = NoInputAndNoOutputInputFuture;
|
3466 3645 |
|
3467 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3646 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3468 3647 | let fut = async move {
|
3469 3648 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3470 3649 | request.headers(),
|
3471 3650 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_0,
|
3472 3651 | ) {
|
3473 3652 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3474 3653 | }
|
3475 3654 | crate::protocol_serde::shape_no_input_and_no_output::de_no_input_and_no_output_http_request(request)
|
3476 3655 | .await
|
3477 3656 | };
|
3478 3657 | use ::futures_util::future::TryFutureExt;
|
3479 3658 | let fut = fut.map_err(
|
3480 3659 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3481 3660 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3482 3661 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3483 3662 | },
|
3484 3663 | );
|
3485 3664 | NoInputAndNoOutputInputFuture {
|
3486 3665 | inner: Box::pin(fut),
|
3487 3666 | }
|
3488 3667 | }
|
3489 3668 | }
|
3490 3669 | impl
|
3491 3670 | ::aws_smithy_http_server::response::IntoResponse<
|
3492 3671 | ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
|
3493 3672 | > for crate::output::NoInputAndNoOutputOutput
|
3494 3673 | {
|
3495 3674 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3496 3675 | match crate::protocol_serde::shape_no_input_and_no_output::ser_no_input_and_no_output_http_response(self) {
|
3497 3676 | Ok(response) => response,
|
3498 3677 | Err(e) => {
|
3499 3678 | ::tracing::error!(error = %e, "failed to serialize response");
|
3500 3679 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3501 3680 | }
|
3502 3681 | }
|
3503 3682 | }
|
3504 3683 | }
|
3505 3684 |
|
3506 3685 | #[allow(unreachable_code, unused_variables)]
|
3507 3686 | #[cfg(test)]
|
3508 3687 | mod no_input_and_no_output_test {
|
3509 3688 |
|
3510 3689 | /// Clients must always send an empty JSON object payload for
|
3511 3690 | /// operations with no input (that is, `{}`). While AWS service
|
3512 3691 | /// implementations support requests with no payload or requests
|
3513 3692 | /// that send `{}`, always sending `{}` from the client is
|
3514 3693 | /// preferred for forward compatibility in case input is ever
|
3515 3694 | /// added to an operation.
|
3516 3695 | /// Test ID: AwsJson10MustAlwaysSendEmptyJsonPayload
|
3517 3696 | #[::tokio::test]
|
3518 3697 | #[::tracing_test::traced_test]
|
3519 3698 | async fn aws_json10_must_always_send_empty_json_payload_request() {
|
3520 3699 | #[allow(unused_mut)]
|
3521 - | let mut http_request = http::Request::builder()
|
3700 + | let mut http_request = ::http_1x::Request::builder()
|
3522 3701 | .uri("/")
|
3523 3702 | .method("POST")
|
3524 3703 | .header("Content-Type", "application/x-amz-json-1.0")
|
3525 3704 | .header("X-Amz-Target", "JsonRpc10.NoInputAndNoOutput")
|
3526 - | .body(::aws_smithy_http_server::body::Body::from(
|
3527 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3705 + | .body(::aws_smithy_http_server::body::boxed(
|
3706 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3707 + | &::aws_smithy_protocol_test::decode_body_data(
|
3528 3708 | "{}".as_bytes(),
|
3529 3709 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3710 + | ),
|
3530 3711 | )),
|
3531 3712 | ))
|
3532 3713 | .unwrap();
|
3533 3714 | #[allow(unused_mut)]
|
3534 3715 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3535 3716 | let config = crate::service::JsonRpc10Config::builder().build();
|
3536 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3717 + | let service =
|
3718 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
3719 + | config,
|
3720 + | )
|
3537 3721 | .no_input_and_no_output(move |input: crate::input::NoInputAndNoOutputInput| {
|
3538 3722 | let sender = sender.clone();
|
3539 3723 | async move {
|
3540 3724 | let result = {
|
3541 3725 | let expected = crate::input::NoInputAndNoOutputInput {};
|
3542 3726 | ::pretty_assertions::assert_eq!(input, expected);
|
3543 3727 | let output = crate::output::NoInputAndNoOutputOutput {};
|
3544 3728 | output
|
3545 3729 | };
|
3546 3730 | sender.send(()).await.expect("receiver dropped early");
|
3547 3731 | result
|
3548 3732 | }
|
3549 3733 | })
|
3550 3734 | .build_unchecked();
|
3551 3735 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3552 3736 | .await
|
3553 3737 | .expect("unable to make an HTTP request");
|
3554 3738 | assert!(
|
3555 3739 | receiver.recv().await.is_some(),
|
3556 3740 | "we expected operation handler to be invoked but it was not entered"
|
3557 3741 | );
|
3558 3742 | }
|
3559 3743 |
|
3560 3744 | /// Service implementations must support no payload or an empty
|
3561 3745 | /// object payload for operations that define no input. However,
|
3562 3746 | /// despite the lack of a payload, a Content-Type header is still
|
3563 3747 | /// required in order for the service to properly detect the
|
3564 3748 | /// protocol.
|
3565 3749 | /// Test ID: AwsJson10ServiceSupportsNoPayloadForNoInput
|
3566 3750 | #[::tokio::test]
|
3567 3751 | #[::tracing_test::traced_test]
|
3568 3752 | async fn aws_json10_service_supports_no_payload_for_no_input_request() {
|
3569 3753 | #[allow(unused_mut)]
|
3570 - | let mut http_request = http::Request::builder()
|
3754 + | let mut http_request = ::http_1x::Request::builder()
|
3571 3755 | .uri("/")
|
3572 3756 | .method("POST")
|
3573 3757 | .header("Content-Type", "application/x-amz-json-1.0")
|
3574 3758 | .header("X-Amz-Target", "JsonRpc10.NoInputAndNoOutput")
|
3575 - | .body(::aws_smithy_http_server::body::Body::from(
|
3576 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3759 + | .body(::aws_smithy_http_server::body::boxed(
|
3760 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3761 + | &::aws_smithy_protocol_test::decode_body_data(
|
3577 3762 | "".as_bytes(),
|
3578 3763 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3764 + | ),
|
3579 3765 | )),
|
3580 3766 | ))
|
3581 3767 | .unwrap();
|
3582 3768 | #[allow(unused_mut)]
|
3583 3769 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3584 3770 | let config = crate::service::JsonRpc10Config::builder().build();
|
3585 - | let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
|
3771 + | let service =
|
3772 + | crate::service::JsonRpc10::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
3773 + | config,
|
3774 + | )
|
3586 3775 | .no_input_and_no_output(move |input: crate::input::NoInputAndNoOutputInput| {
|
3587 3776 | let sender = sender.clone();
|
3588 3777 | async move {
|
3589 3778 | let result = {
|
3590 3779 | let expected = crate::input::NoInputAndNoOutputInput {};
|
3591 3780 | ::pretty_assertions::assert_eq!(input, expected);
|
3592 3781 | let output = crate::output::NoInputAndNoOutputOutput {};
|
3593 3782 | output
|
3594 3783 | };
|
3595 3784 | sender.send(()).await.expect("receiver dropped early");
|
3596 3785 | result
|
3597 3786 | }
|
3598 3787 | })
|
3599 3788 | .build_unchecked();
|
3600 3789 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3601 3790 | .await
|
3602 3791 | .expect("unable to make an HTTP request");
|
3603 3792 | assert!(
|
3604 3793 | receiver.recv().await.is_some(),
|
3605 3794 | "we expected operation handler to be invoked but it was not entered"
|
3606 3795 | );
|
3607 3796 | }
|
3608 3797 |
|
3609 3798 | /// When no output is defined, the service is expected to return
|
3610 3799 | /// an empty payload. Despite the lack of a payload, the service
|
3611 3800 | /// is expected to always send a Content-Type header. Clients must
|
3612 3801 | /// handle cases where a service returns a JSON object and where
|
3613 3802 | /// a service returns no JSON at all.
|
3614 3803 | /// Test ID: AwsJson10ServiceRespondsWithNoPayload
|
3615 3804 | #[::tokio::test]
|
3616 3805 | #[::tracing_test::traced_test]
|
3617 3806 | async fn aws_json10_service_responds_with_no_payload_response() {
|
3618 3807 | let output = crate::output::NoInputAndNoOutputOutput {};
|
3619 3808 | use ::aws_smithy_http_server::response::IntoResponse;
|
3620 3809 | let http_response = output.into_response();
|
3621 3810 | ::pretty_assertions::assert_eq!(
|
3622 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3811 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3623 3812 | http_response.status()
|
3624 3813 | );
|
3625 3814 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0")];
|
3626 3815 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3627 3816 | http_response.headers(),
|
3628 3817 | expected_headers,
|
3629 3818 | ));
|
3630 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3819 + | use ::http_body_util::BodyExt;
|
3820 + | let body = http_response
|
3821 + | .into_body()
|
3822 + | .collect()
|
3631 3823 | .await
|
3632 - | .expect("unable to extract body to bytes");
|
3824 + | .expect("unable to collect body")
|
3825 + | .to_bytes();
|
3633 3826 | // No body.
|
3634 3827 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
3635 3828 | }
|
3636 3829 | }
|