GetURIStringPointer FIXME ...
(baseUrl string, relativePath string, query url.Values)
| 455 | |
| 456 | // GetURIStringPointer FIXME ... |
| 457 | func GetURIStringPointer(baseUrl string, relativePath string, query url.Values) (*string, errors.Error) { |
| 458 | // If the base URL doesn't end with a slash, and has a relative path attached |
| 459 | // the values will be removed by the Go package, therefore we need to add a missing slash. |
| 460 | AddMissingSlashToURL(&baseUrl) |
| 461 | base, err := url.Parse(baseUrl) |
| 462 | if err != nil { |
| 463 | return nil, errors.Convert(err) |
| 464 | } |
| 465 | // If the relative path starts with a '/', we need to remove it or the values will be removed by the Go package. |
| 466 | relativePath = RemoveStartingSlashFromPath(relativePath) |
| 467 | u, err := url.Parse(relativePath) |
| 468 | if err != nil { |
| 469 | return nil, errors.Convert(err) |
| 470 | } |
| 471 | if query != nil { |
| 472 | queryString := u.Query() |
| 473 | for key, values := range query { |
| 474 | for _, v := range values { |
| 475 | queryString.Add(key, v) |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | u.RawQuery = queryString.Encode() |
| 480 | } |
| 481 | uri := base.ResolveReference(u).String() |
| 482 | return &uri, nil |
| 483 | } |
| 484 | |
| 485 | // AddMissingSlashToURL FIXME ... |
| 486 | func AddMissingSlashToURL(baseUrl *string) { |
no test coverage detected