Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admatic: Add headers #4083

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open

Admatic: Add headers #4083

wants to merge 52 commits into from

Conversation

bakicam
Copy link
Contributor

@bakicam bakicam commented Dec 1, 2024

No description provided.

Copy link

github-actions bot commented Dec 1, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, e7b6f38

admatic

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:22:	Builder				100.0%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:34:	MakeRequests			69.2%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:84:	buildEndpointFromRequest	87.5%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:106:	MakeBids			94.4%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:141:	getMediaTypeForBid		88.9%
total:									(statements)			83.3%

Copy link

github-actions bot commented Dec 1, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 26e50b2

admatic

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:22:	Builder				100.0%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:34:	MakeRequests			69.2%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:84:	buildEndpointFromRequest	87.5%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:106:	MakeBids			94.4%
github.com/prebid/prebid-server/v3/adapters/admatic/admatic.go:141:	getMediaTypeForBid		88.9%
total:									(statements)			83.3%

@bsardo bsardo changed the title Add Admatic Adapter Headers Admatic: Add headers Dec 4, 2024
@bsardo bsardo self-assigned this Dec 11, 2024
Comment on lines +38 to +53
headers := http.Header{}
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
if request.Device != nil {
if len(request.Device.UA) > 0 {
headers.Add("User-Agent", request.Device.UA)
}

if len(request.Device.IPv6) > 0 {
headers.Add("X-Forwarded-For", request.Device.IPv6)
}

if len(request.Device.IP) > 0 {
headers.Add("X-Forwarded-For", request.Device.IP)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add JSON test coverage for this logic by adding and/or updating 2 JSON tests, one where device is nil and one where device is not nil with ua, ip and ipv6 set. You can verify the headers are set correctly by including the following in your JSON test:

"httpCalls": [
    {
      "expectedRequest": {
        "headers": {
          "Content-Type": [
            "application/json;charset=utf-8"
          ],
          "Accept": [
            "application/json"
          ],
          etc...
``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants