1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef COMMUNICATIONNETSTACK_CONSTANT_H 17 #define COMMUNICATIONNETSTACK_CONSTANT_H 18 19 #include <cstdint> 20 21 #include "nocopyable.h" 22 23 namespace OHOS::NetStack::Fetch { 24 class FetchConstant final { 25 public: 26 DISALLOW_COPY_AND_MOVE(FetchConstant); 27 28 /* Http Method */ 29 static const char *const HTTP_METHOD_GET; 30 static const char *const HTTP_METHOD_HEAD; 31 static const char *const HTTP_METHOD_OPTIONS; 32 static const char *const HTTP_METHOD_TRACE; 33 static const char *const HTTP_METHOD_DELETE; 34 static const char *const HTTP_METHOD_POST; 35 static const char *const HTTP_METHOD_PUT; 36 static const char *const HTTP_METHOD_CONNECT; 37 38 /* options key */ 39 static const char *const PARAM_KEY_URL; 40 static const char *const PARAM_KEY_METHOD; 41 static const char *const PARAM_KEY_DATA; 42 static const char *const PARAM_KEY_HEADER; 43 static const char *const PARAM_KEY_SUCCESS; 44 static const char *const PARAM_KEY_FAIL; 45 static const char *const PARAM_KEY_COMPLETE; 46 static const char *const PARAM_KEY_RESPONSE_TYPE; 47 48 static const char *const RESPONSE_KEY_DATA; 49 static const char *const RESPONSE_KEY_CODE; 50 static const char *const RESPONSE_KEY_HEADERS; 51 52 static const char *const HTTP_URL_PARAM_START; 53 static const char *const HTTP_URL_PARAM_SEPARATOR; 54 static const char *const HTTP_URL_NAME_VALUE_SEPARATOR; 55 static const char *const HTTP_HEADER_SEPARATOR; 56 static const char *const HTTP_LINE_SEPARATOR; 57 58 static const char *const HTTP_DEFAULT_USER_AGENT; 59 static const char *const HTTP_PREPARE_CA_PATH; 60 61 static const char *const HTTP_CONTENT_TYPE; 62 static const char *const HTTP_CONTENT_TYPE_URL_ENCODE; 63 static const char *const HTTP_CONTENT_TYPE_JSON; 64 65 static const char *const HTTP_RESPONSE_TYPE_TEXT; 66 static const char *const HTTP_RESPONSE_TYPE_JSON; 67 }; 68 } // namespace OHOS::NetStack::Fetch 69 70 #endif /* COMMUNICATIONNETSTACK_CONSTANT_H */ 71