package com.github.davidmoten.flashq;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

public class Parameters {

	public static String toString(HttpServletRequest req) {
		StringBuilder s = new StringBuilder();
		@SuppressWarnings("unchecked")
		Enumeration<String> en = req.getParameterNames();
		while (en.hasMoreElements()) {
			String key = en.nextElement();
			String[] values = req.getParameterValues(key);
			s.append(key);
			s.append("=");
			// assume one value per key
			if (values.length > 0)
				s.append(values[0]);
			s.append("||");
		}
		return s.toString();
	}

}

@@ -444,92 +444,54 @@
 %0A%09%09%09
-s.append(key);%0A%09%09%09s.append(%22=%22);%0A%09%09%09// assume one value per key%0A
+for (String value : values) %7B%0A%09
 %09%09%09if (
-value
 s.length
  %3E 0
@@ -490,14 +490,17 @@
 ngth
+()
  %3E 0)%0A
+%09
 %09%09%09%09
@@ -512,20 +512,35 @@
 end(
-values%5B0%5D
+%22%7C%7C%22);%0A%09%09%09%09s.append(key
 );%0A
+%09
 %09%09%09s
@@ -548,22 +548,47 @@
 append(%22
-%7C%7C
+=
 %22);%0A
+%09%09%09%09s.append(value);%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%09re

include all repeats of parameter values