package common
import (
+ "log"
"net"
"os"
)
}
return
}
+
+func CheckError(err error) bool {
+ if err != nil {
+ log.Println(err.Error())
+ return true
+ }
+ return false
+}
+++ /dev/null
-/*******************************************************************************
- * Copyright 2019 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *******************************************************************************/
-package httpclient
-
-const (
- // ConstWellknownPort is wellknonw port
- ConstWellknownPort = 56001
-
- // ConstLocalTarget is for knowing local environments
- ConstLocalTarget = "localhost"
-
- // ConstPrefixHTTP is "http://"
- ConstPrefixHTTP = "http://"
-)
+package httpclient
+
/*******************************************************************************
* Copyright 2019 Samsung Electronics All Rights Reserved.
*
* limitations under the License.
*
*******************************************************************************/
-package httpclient
import (
"bytes"
+package httpclient
+
/*******************************************************************************
* Copyright 2019 Samsung Electronics All Rights Reserved.
*
* limitations under the License.
*
*******************************************************************************/
-package httpclient
import (
"encoding/json"
var (
server *httptest.Server
mockRemoteAddr string
-)
-var keyFilePath string = "./../../securemgr/test/key.txt"
+ keyFilePath = "./../../securemgr/test/key.txt"
+)
func writeJSONResponse(w http.ResponseWriter, data []byte, status int) {
log.Printf("[%s] writeJSONResponse: %s", "test", data)
--- /dev/null
+package httpclient
+
+/*******************************************************************************
+ * Copyright 2019 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *******************************************************************************/
+
+var (
+ logPrefix = "httpclient"
+)
+
+const (
+ // ConstWellknownPort is wellknonw port
+ ConstWellknownPort = 56001
+
+ // ConstLocalTarget is for knowing local environments
+ ConstLocalTarget = "localhost"
+
+ // ConstPrefixHTTP is "http://"
+ ConstPrefixHTTP = "http://"
+
+ // ConstServiceExecuteURI is URI for creating & executing service
+ ConstServiceExecuteURI = "/api/v1/servicemgr/services"
+
+ // ConstGetScoreURI is URI for getting score value
+ ConstGetScoreURI = "/api/v1/scoringmgr/score/"
+
+ // ConstServiceStatusNotiURI is URI for notification status of service
+ ConstServiceStatusNotiURI = "/api/v1/servicemgr/services/notification/"
+)