1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.adservices.service.common.httpclient; 18 19 import com.google.common.collect.ImmutableMap; 20 import com.google.common.collect.ImmutableSet; 21 22 public class AdServicesHttpUtil { 23 public static final String CONTENT_LENGTH_HDR = "Content-Length"; 24 public static final byte[] EMPTY_BODY = new byte[0]; 25 public static String CONTENT_TYPE_HDR = "Content-Type"; 26 public static String PROTOBUF_CONTENT_TYPE = "application/x-protobuf"; 27 public static String OHTTP_CONTENT_TYPE = "message/ohttp-req"; 28 public static String OHTTP_KEYS_CONTENT_TYPE = "application/ohttp-keys"; 29 ; 30 31 public enum HttpMethodType { 32 GET, 33 POST, 34 } 35 36 public static ImmutableMap<String, String> REQUEST_PROPERTIES_PROTOBUF_CONTENT_TYPE = 37 ImmutableMap.of(CONTENT_TYPE_HDR, PROTOBUF_CONTENT_TYPE); 38 39 public static ImmutableMap<String, String> REQUEST_PROPERTIES_OHTTP_KEYS_TYPE = 40 ImmutableMap.of(CONTENT_TYPE_HDR, OHTTP_KEYS_CONTENT_TYPE); 41 42 public static ImmutableSet<String> RESPONSE_PROPERTIES_CONTENT_TYPE = 43 ImmutableSet.of(CONTENT_TYPE_HDR); 44 45 public static ImmutableMap<String, String> REQUEST_PROPERTIES_OHTTP_CONTENT_TYPE = 46 ImmutableMap.of(CONTENT_TYPE_HDR, OHTTP_CONTENT_TYPE); 47 } 48