# Unsupported protocol scheme

**URL:** <https://forum.golangbridge.org/t/unsupported-protocol-scheme/27431>\
**Category:** Getting Help\
**Created:** [May 12, 2022, 3:12pm UTC](https://forum.golangbridge.org/t/unsupported-protocol-scheme/27431 "2022-05-12T15:12:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyousef](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/hyousef/32/9127_2.png) [@hyousef](https://forum.golangbridge.org/u/hyousef)\
**Post date:** [May 12, 2022, 3:12pm UTC](https://forum.golangbridge.org/t/unsupported-protocol-scheme/27431/1 "2022-05-12T15:12:57Z")

</div>

I’ve the below url that is getting a JSON as responce:  
[https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129](https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129)

Trying to get the same output through GO, so I wrote the below [Go Playground - The Go Programming Language](https://go.dev/play/p/uKJ58ADVxx2:)

```go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?", nil)

	q := req.URL.Query()
	q.Add("barcode", "6287029390129")
	//q.Add("another_thing", "foo & bar")
	req.URL.RawQuery = q.Encode()

	fmt.Println(req.URL.String())

	// url := "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129"
	resp, err := http.Get(req.URL.RawQuery) //
	_ = req.URL.RawQuery
	if err != nil {
		log.Fatalln(err)
	}

	//We Read the response body on the line below.
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatalln(err)
	}
	//Convert the body to type string
	sb := string(body)
	log.Printf(sb)
}

```

But I got the below error:

```bash
2009/11/10 23:00:00 Get "barcode=6287029390129": unsupported protocol scheme ""

```

**UPDATE**  
Based on some comments recieved, I changed `resp, err := http.Get(req.URL.RawQuery)` to be: `resp, err := http.Get(req.URL.String())`, also I used it as: `resp, err := http.DefaultClient.Do(req)` [Go Playground - The Go Programming Language](https://go.dev/play/p/1vjS1NjL8IE)

But I got the below error in both cases:

```bash
2009/11/10 23:00:00 Get "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129": dial tcp: lookup script.google.com on 169.254.169.254:53: dial udp 169.254.169.254:53: connect: no route to host

```

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [August 10, 2022, 3:13pm UTC](https://forum.golangbridge.org/t/unsupported-protocol-scheme/27431/2 "2022-08-10T15:13:28Z")

</div>

Closed on August 10, 2022, 3:13pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
