File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 1+ using  System . Text . Json . Serialization ; 
2+ using  PuppeteerSharp . Helpers . Json ; 
3+ 
14namespace  PuppeteerSharp 
25{ 
36    /// <summary> 
@@ -91,7 +94,9 @@ public class CookieParam
9194        /// <summary> 
9295        /// Cookie partition key. The site of the top-level URL the browser was visiting at the 
9396        /// start of the request to the endpoint that set the cookie. Supported only in Chrome. 
97+         /// TODO: a breaking change is needed to support other partition keys. 
9498        /// </summary> 
99+         [ JsonConverter ( typeof ( CookiePartitionKeyConverter ) ) ] 
95100        public  string  PartitionKey  {  get ;  set ;  } 
96101
97102        /// <summary> 
Original file line number Diff line number Diff line change 1+ #nullable enable
2+ 
3+ using  System ; 
4+ using  System . Text . Json ; 
5+ using  System . Text . Json . Nodes ; 
6+ using  System . Text . Json . Serialization ; 
7+ 
8+ namespace  PuppeteerSharp . Helpers . Json 
9+ { 
10+     internal  sealed  class  CookiePartitionKeyConverter  :  JsonConverter < string > 
11+     { 
12+         /// <inheritdoc cref="JsonConverter"/> 
13+         public  override  bool  CanConvert ( Type  objectType )  =>  typeof ( string ) . IsAssignableFrom ( objectType ) ; 
14+ 
15+         /// <inheritdoc cref="JsonConverter"/> 
16+         public  override  string ?  Read ( 
17+             ref  Utf8JsonReader  reader , 
18+             Type  objectType , 
19+             JsonSerializerOptions  options ) 
20+         { 
21+             JsonNode ?  node  =  JsonNode . Parse ( ref  reader ) ; 
22+ 
23+             return  node ? [ "topLevelSite" ] ? . GetValue < string > ( )  ??  null ; 
24+         } 
25+ 
26+         /// <inheritdoc cref="JsonConverter"/> 
27+         public  override  void  Write ( 
28+             Utf8JsonWriter  writer , 
29+             string  value , 
30+             JsonSerializerOptions  options ) 
31+         { 
32+             if  ( value  !=  null  &&  writer  !=  null ) 
33+             { 
34+                 writer . WriteStartObject ( "partitionKey" ) ; 
35+                 writer . WriteString ( "topLevelSite" ,  value ) ; 
36+                 writer . WriteBoolean ( "hasCrossSiteAncestor" ,  false ) ; 
37+                 writer . WriteEndObject ( ) ; 
38+             } 
39+         } 
40+     } 
41+ } 
Original file line number Diff line number Diff line change 1212    <Description >Headless Browser .NET API</Description >
1313    <PackageId >PuppeteerSharp</PackageId >
1414    <PackageReleaseNotes ></PackageReleaseNotes >
15-     <PackageVersion >20.0.1-beta1 </PackageVersion >
16-     <ReleaseVersion >20.0.1 </ReleaseVersion >
17-     <AssemblyVersion >20.0.1 </AssemblyVersion >
18-     <FileVersion >20.0.1 </FileVersion >
15+     <PackageVersion >20.0.2 </PackageVersion >
16+     <ReleaseVersion >20.0.2 </ReleaseVersion >
17+     <AssemblyVersion >20.0.2 </AssemblyVersion >
18+     <FileVersion >20.0.2 </FileVersion >
1919    <SynchReleaseVersion >false</SynchReleaseVersion >
2020    <StyleCopTreatErrorsAsWarnings >false</StyleCopTreatErrorsAsWarnings >
2121    <DebugType >embedded</DebugType >
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments