Coverage Summary for Class: HttpUtils (org.ethereum.rpc)
Class |
Class, %
|
Method, %
|
Line, %
|
HttpUtils |
0%
(0/1)
|
0%
(0/2)
|
0%
(0/7)
|
1 package org.ethereum.rpc;
2
3 public class HttpUtils {
4
5 /** This function is strongly based on the function from netty 4.1, since
6 * we have an older version from it and do not need the overhead of checking
7 * the rest of the implementation for security reasons.
8 *
9 * @param contentTypeValue the value obtained from the header Content-Type
10 * @return only the mime type, ignoring charset or other values after ;
11 */
12 public static String getMimeType(String contentTypeValue) {
13 if (contentTypeValue == null) {
14 return null;
15 }
16
17 int indexOfSemicolon = contentTypeValue.indexOf(';');
18 if (indexOfSemicolon != -1) {
19 return contentTypeValue.substring(0, indexOfSemicolon);
20 } else {
21 return contentTypeValue.length() > 0 ? contentTypeValue : null;
22 }
23
24 }
25 }