@Test public void formParametersAreEncoded() { final Map<String, List<String>> formParameters = new HashMap<>(); formParameters.put("emptyParam", singletonList("")); formParameters.put("escape&this=", singletonList("and&this%")); formParameters.put("param2", asList("foo", "bar")); final Buffer serialized = SERIALIZER.serialize(headers, formParameters, DEFAULT_ALLOCATOR); assertEquals("Unexpected serialized content.", "emptyParam=&escape%26this%3D=and%26this%25&param2=foo&param2=bar", serialized.toString(UTF_8)); assertTrue("Unexpected content type.", headers.contains(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8")); }
@SuppressWarnings("ConstantConditions") @Override public Buffer serialize(final HttpHeaders headers, final Map<String, List<String>> parameters, final BufferAllocator allocator) { addContentType.accept(headers); return serialize(parameters, allocator, false); }
FormUrlEncodedHttpSerializer implements HttpSerializer<Map<String, List<String>>> { @SuppressWarnings("ConstantConditions") @Override public Buffer serialize(final HttpHeaders headers, final Map<String, List<String>> parameters, final BufferAllocator allocator) { addContentType.accept(headers); return serialize(parameters, allocator, false); } }
FormUrlEncodedHttpSerializer implements HttpSerializer<Map<String, List<String>>> { @SuppressWarnings("ConstantConditions") @Override public Buffer serialize(final HttpHeaders headers, final Map<String, List<String>> parameters, final BufferAllocator allocator) { addContentType.accept(headers); return serialize(parameters, allocator, false); } FormUrlEncodedHttpSerializer(final Charset charset, final Consumer<HttpHeaders> addContentType); }
FormUrlEncodedHttpSerializer implements HttpSerializer<Map<String, List<String>>> { @SuppressWarnings("ConstantConditions") @Override public Buffer serialize(final HttpHeaders headers, final Map<String, List<String>> parameters, final BufferAllocator allocator) { addContentType.accept(headers); return serialize(parameters, allocator, false); } FormUrlEncodedHttpSerializer(final Charset charset, final Consumer<HttpHeaders> addContentType); @SuppressWarnings("ConstantConditions") @Override Buffer serialize(final HttpHeaders headers,
                            final Map<String, List<String>> parameters,
                            final BufferAllocator allocator); @Override BlockingIterable<Buffer> serialize(final HttpHeaders headers,
                                              final BlockingIterable<Map<String, List<String>>> parameters,
                                              final BufferAllocator allocator); @Override Publisher<Buffer> serialize(final HttpHeaders headers,
                                       final Publisher<Map<String, List<String>>> parameters,
                                       final BufferAllocator allocator); @Override HttpPayloadWriter<Map<String, List<String>>> serialize(final HttpHeaders headers,
                                                                  final HttpPayloadWriter<Buffer> payloadWriter,
                                                                  final BufferAllocator allocator); }
FormUrlEncodedHttpSerializer implements HttpSerializer<Map<String, List<String>>> { @SuppressWarnings("ConstantConditions") @Override public Buffer serialize(final HttpHeaders headers, final Map<String, List<String>> parameters, final BufferAllocator allocator) { addContentType.accept(headers); return serialize(parameters, allocator, false); } FormUrlEncodedHttpSerializer(final Charset charset, final Consumer<HttpHeaders> addContentType); @SuppressWarnings("ConstantConditions") @Override Buffer serialize(final HttpHeaders headers,
                            final Map<String, List<String>> parameters,
                            final BufferAllocator allocator); @Override BlockingIterable<Buffer> serialize(final HttpHeaders headers,
                                              final BlockingIterable<Map<String, List<String>>> parameters,
                                              final BufferAllocator allocator); @Override Publisher<Buffer> serialize(final HttpHeaders headers,
                                       final Publisher<Map<String, List<String>>> parameters,
                                       final BufferAllocator allocator); @Override HttpPayloadWriter<Map<String, List<String>>> serialize(final HttpHeaders headers,
                                                                  final HttpPayloadWriter<Buffer> payloadWriter,
                                                                  final BufferAllocator allocator);  }