Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] java – How to remove User-Agent String when I make a http post call?

Posted on November 11, 2022 By

Solution 1 :

This will remove it for any request the client sends.

  OkHttpClient client = new OkHttpClient.Builder()
      .addNetworkInterceptor(chain -> chain.proceed(chain.request().newBuilder()
          .removeHeader("user-agent")
          .build()))
      .build();

Problem :

I want to remove “User-Agent” property from my post httprequest.

I’m using okhttpclient.

Can anyone help me with snippet of code?

Comments

Comment posted by Sairaj Sawant

Any particular reason to not include User-agent?

READ  [FIXED] c# - image in new xaml from images of a griview xamarin forms
Powered by Inline Related Posts
Android Tags:android, httprequest, java, okhttp, user-agent

Post navigation

Previous Post: [FIXED] java – android studio 4.0 cannot load jdk class
Next Post: [FIXED] java – How can ViewParent be cast into View?

Related Posts

[FIXED] Plugin [id: ‘com.android.application’, version: ‘7.3.0’, apply: false] was not found in any of the following sources: Android
[FIXED] android – Cannot build a query from generated Apollo class in Kotlin (.builder() is absent) Android
[FIXED] java – Simulate a single tap repeatedly at regular intervals. Can i set to work for on background? (On other apps or Device Menu) Android
[FIXED] android – How to keep a reference to a thread between activity destruction and recreation? Android
[FIXED] java – Bottom Navigation showing in other fragment Android
[FIXED] xml – Failed to initialize editor. when update android studio Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme